MenuItem¶
-
class
consolemenu.items.
MenuItem
(text, menu=None, should_exit=False, menu_char=None)[source]¶ A generic menu item
Variables: - text (str) – The text shown for this menu item
- menu (ConsoleMenu) – The menu to which this item belongs
- should_exit (bool) – Whether the menu should exit once this item’s action is done
- menu_char (str) – The character used to select this menu item. Optional - defaults to None.
-
get_return
()[source]¶ Override to change what the item returns. Otherwise just returns the same value the last selected item did.
-
show
(index)[source]¶ 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