from time import sleep import pygame import pygame_menu from pygame_menu import themes import pygame_menu.events import pygame_menu.widgets pygame.init() surface = pygame.display.set_mode((600,400)) def set_Difficulty(value, Difficulty): print(value) print(Difficulty) def start_the_game(): pass def level_menu(): mainmenu._open(level) mainmenu = pygame_menu.Menu('Welcome', 600,400, theme=themes.THEME_SOLARIZED) mainmenu.add.text_input('Name: ', default='username', maxchar=20) mainmenu.add.button('Play', start_the_game) mainmenu.add.button('Levels', level_menu) mainmenu.add.button('Quit', pygame_menu.events.EXIT) level = pygame_menu.Menu('Select a Difficulty', 600, 400, theme=themes.THEME_BLUE) level.add.selector('Difficulty:',[('Hard',1),('Easy',2)], onchange=set_Difficulty) while True: events = pygame.event.get() for event in events: if event.type == pygame.QUIT: exit() if mainmenu.is_enabled(): mainmenu.update(events) mainmenu.draw(surface) pygame.display.update()