VisuaLife
latest

Documentation

  • Installation
  • Examples gallery
  • Live demo
  • How To
  • Tutorials
  • Brython tips
  • Change log
  • Development

API reference

  • visualife.calc Package
  • visualife.calc.math_utils Module
  • visualife.core Package
  • visualife.core.styles Module
  • visualife.core.shapes Module
  • visualife.core.three_d Package
  • visualife.data Package
  • visualife.diagrams Package
  • visualife.serverside Package
  • visualife.utils Package
    • Functions
    • Classes
      • MenuWidget
  • visualife.widget Package
  • Data formats
VisuaLife
  • Docs »
  • visualife.utils Package »
  • MenuWidget
  • Edit on Bitbucket

MenuWidget¶

class visualife.utils.MenuWidget(element_id, dict_of_menu_items={}, **kwargs)¶

Bases: object

Creates 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: "burger or "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.

Next Previous

© Copyright 2018, J.D. Kryś, D. Gront and few others Revision f048be61.

Built with Sphinx using a theme provided by Read the Docs.