-
Notifications
You must be signed in to change notification settings - Fork 36
Closed
Labels
Description
It would be really nice if we could bind the "Back"-button in the first page of a PagedMenu() manually in our scripts. Example script of how it could look in usage:
def some_menu(index):
menu = SimpleMenu()
menu.append(SimpleOption(1, "some other menu", 1)
menu.select_callback = some_menu_callback
menu.send(index)
def some_menu_callback(menu, index, option):
if option.value == 1:
some_other_menu(index)
def some_other_menu(index):
# create a paged menu with 2 pages
menu = PagedMenu()
for x in range(1, 10):
menu.append(PagedOption(x, x))
# this would tell the PagedMenu that we want to bind the "Back"-button on the first page on ourselves
# the argument is what would be passed as option.value in the callback
menu.add_back_option('go_back')
menu.select_callback = some_other_menu_callback
menu.send(index)
def some_other_menu_callback(menu, index, option):
if option.value == "go_back":
# would be only called if we are in the first page of the menu, otherwise behave normally
return some_menu(index)
print(option.value)
Might not be the best way to do this, but it's just an idea so you know what I mean.