MenuWidget¶
-
class
visualife.utils.MenuWidget(element_id, dict_of_menu_items={}, **kwargs)¶ Bases:
objectCreates a HTML menu
Parameters: - element_id – ID of a html DIV element that will contain this menu instance
- dict_of_menu_items – dictionary that contains the menu
- kwargs – see below
Keyword Arguments: - style (
string) – style of “burger” icon:"burgeror"dots" - width (
int) – width of menu in pixels
Methods Summary
add_menu_option(new_option, callback_or_submenu)Adds option to the menu delete_option(option_to_delete)Delete option from a Menu with all its suboptions print_menu()Prints current menu, print is included in a function so you don’t need to call print with this function update_menu()Recalculates Menu with current dict_of_menu_items. Methods Documentation
-
add_menu_option(new_option, callback_or_submenu)¶ Adds option to the menu
Parameters: - new_option – name od added option
- callback_or_submenu – function object ot a dictionary which has names of options
as a keys and callback_functions as values
-
delete_option(option_to_delete)¶ Delete option from a Menu with all its suboptions
-
print_menu()¶ Prints current menu, print is included in a function so you don’t need to call print with this function
-
update_menu()¶ Recalculates Menu with current dict_of_menu_items. Must be call after add_menu_option() to iclude new options in MenuWidget.