Is there any event handler to minimize or maximize screen like there is to quit screen?
for event in pygame.event.get():
if event.type == pygame.QUIT:
pygame.quit()
quit()
Is there any event handler to minimize or maximize screen like there is to quit screen?
for event in pygame.event.get():
if event.type == pygame.QUIT:
pygame.quit()
quit()
Pygame adds
pygame.ACTIVEEVENT
s to the event queue when the window is minimized/iconified or maximized. You can checkif event.gain == 1 and event.state == 6:
andif event.gain == 0 and event.state == 6:
to see if the window was maximized or minimized. The only problem is thatevent.gain == 1 and event.state == 6
is alsoTrue
when the window gains input focus.If you want to minimize/iconify the window with a key press, you can call
pygame.display.iconify()
.