1

How do I change the background to another one. After client clicks the first button I want it to change background image. The part when I call AmountOfPlayers() is where I need it.

pygame.init()
while True:
    size=(1440,810)
    screen = pygame.display.set_mode(size)
    pygame.display.set_caption("POCKER SFAHOT")
    welcomeimage = 'welcome.png'
    imgwelcome = pygame.image.load(welcomeimage)
    screen.blit(imgwelcome, (0,0))
    pygame.display.flip()
    for event in pygame.event.get():
        if event.type == pygame.MOUSEBUTTONDOWN:
            mouse = pygame.mouse.get_pos()
            if (300 <= mouse[0] <= 1150) and (470 <= mouse[1] <= 600):
                AmountOfPlayers()
    pygame.event.get()
  • It is not allowed to have 2 user accounts. ([new with pygame. My button doesnt work. why?](https://stackoverflow.com/questions/64992901/new-with-pygame-my-button-doesnt-work-why)) – Rabbid76 Nov 24 '20 at 19:50

1 Answers1

0

At the top of your loop, set the background to a color, and when a variable is set to True (when they click), simply set it to a different background color.

ericl16384
  • 326
  • 3
  • 12