I hope this hasn't been asked before. I'm trying to listen to whenever a player presses the '0' or '10' key on the keyboard to close a menu. I want to save previous changes the player made in other menus when the main menu has been closed (either option '4' - currently my manual method - or '0').
Is something like this possible?
Syntax: Select all
def my_callback(menu, index, option):
if option is None: # <--- check for 0
print('0 has been pressed')
menu = SimpleMenu(select_callback=my_callback)
menu.append(SimpleOption(4, 'test', 'test'))
# some more options
menu.send(1) # assuming this index exists
Thanks!
Edit: I'm assuming my_callback doesn't even get called when 0 is pressed. But that's just a thought.
