MenuItem¶
-
class
cursesmenu.items.
MenuItem
(text, menu=None, should_exit=False)¶ A generic menu item
Variables: - text (str) – The text shown for this menu item
- menu (CursesMenu) – The menu to which this item belongs
- should_exit (bool) – Whether the menu should exit once this item’s action is done
-
action
()¶ Override to carry out the main action for this item.
-
clean_up
()¶ Override to add any cleanup actions necessary for the item
-
get_return
()¶ Override to change what the item returns. Otherwise just returns the same value the last selected item did.
-
set_up
()¶ Override to add any setup actions necessary for the item
-
show
(index)¶ How this item should be displayed in the menu. Can be overridden, but should keep the same signature.
Default is:
1 - Item 1
2 - Another Item
Parameters: index (int) – The index of the item in the items list of the menu Returns: The representation of the item to be shown in a menu Return type: str