Button using pygame_menu.events.CLOSE nonfunctional

526 views Asked by At

Though a button calling pygame_menu.events.EXIT works to close the whole Pygame program, one calling pygame_menu.events.CLOSE does not seem to do anything. (Edit: I also tried the menu close() method, but with the same result.) I would like it to close the menu, allowing the program to proceed using the input recorded by the menu.

Here is my minimum reproducible example:

import pygame
import pygame_menu

pygame.init()

screen = pygame.display.set_mode((1000, 700))

menu = pygame_menu.Menu(
    'Hey',
    1000,
    700
)

menu.add.button(
    'Close',
    pygame_menu.events.CLOSE
)
menu.mainloop(screen)

The menu opens and the button appears, but clicking the button does nothing. What should I be doing differently?

Many thanks!

0

There are 0 answers