Closed txoof closed 5 years ago
Hi @txoof Typically it isn't necessary to know the current menu option, as each individual menu item will have its own handler, which performs whatever actions are necessary for that menu item, then returns control back to the menu for the next selection.
However, if you really need to know what the currently-selected item is, you can do so with a separate thread, checking the menu's current_option property. A simple example:
def current_item_checker(menu):
while True:
print 'current menu option:', menu.current_option
time.sleep(5)
.....
# then prior to calling menu.show()...
threading.Thread(target=current_item_checker, kwargs={'menu':menu}).start()
When creating a menu as below, how does one get the index or value of the menu item that was chosen during the input? Is there a way to get the index or value from the SubmenuItem?
I've used
SelectionMenu()
successfully to do this, but can't see how to work with a mixture of items, functions and sub menus.menu.show() returns
None