I'm making this drawing thing in Python with Pygame. I have functions that draw circles and rectangles, but I want to add a function that lets me change the background colour, while not erasing the other circles and rectangles. Here is the code for the rectangles:
def drawRect(surface, colour, x, y, w, h):
pygame.draw.rect(surface, colour, (x, y, w, h))
if event.type == pygame.KEYDOWN:
if event.key == pygame.K_s:
#print("pressed")
drawRect(screen, RANDOM_COLOUR, RANDOM_X, RANDOM_Y, RANDOM_SIZE_X, RANDOM_SIZE_Y)
pygame.display.flip()
A function for it would be best, but any solution would work.