FunctionItem

Bases: consolemenu.items.ExternalItem

class consolemenu.items.FunctionItem(text, function, args=None, kwargs=None, menu=None, should_exit=False, menu_char=None)[source]

A menu item to call a Python function

Variables:
  • text (str) – The text shown for this menu item
  • function – The function to be called
  • args (list) – An optional list of arguments to be passed to the function
  • kwargs (dict) – An optional dictionary of keyword arguments to be passed to the function
  • 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.
action()[source]

This class overrides this method

clean_up()[source]

This class overrides this method

get_return()[source]
Returns:The return value from the function call