Menu widget which allows displaying menu bars, pull-down menus and pop-up menus. More...
Public Member Functions | |
| def | __init__ (self, parent, label=None, popup=False) |
| The constructor. More... | |
| def | activate (self) |
| Sets the state of the menu to NORMAL. More... | |
| def | add (self, itemType, cnf={}, **kw) |
| Appends an item to the menu. More... | |
| def | clear (self) |
| Deletes all menu items. More... | |
| def | deactivate (self) |
| Sets the state of the menu to DISABLED. More... | |
| def | delete (self, index1, index2=None) |
| Deletes menu items between index1 and index2 (included). More... | |
| def | entry_activate (self, index) |
| Sets the state of the menu item denoted by index to NORMAL. More... | |
| def | entry_config (self, index, cnf=None, **kw) |
| Configures a menu item at index. More... | |
| def | entry_deactivate (self, index) |
| Sets the state of the menu item denoted by index to DISABLED. More... | |
| def | entry_get_config (self, index, option) |
| Returns the resource value of a menu item. More... | |
| def | entry_set_variable (self, index, variable=None, offvalue=None, onvalue=None) |
| Sets a variable for the menu at index. More... | |
| def | insert (self, index, itemType, cnf={}, **kw) |
| Inserts an item in the menu at the given index (starting from 0). More... | |
| def | size (self) |
| Returns the number of elements in the items list. More... | |
Public Member Functions inherited from Misc | |
| def | bind (self, sequence=None, func=None, add=None) |
| Redefines the tk.Misc.bind() method. More... | |
| def | config (self, cnf=None, **kw) |
| Configures resources of a widget. More... | |
| def | get_config (self, key) |
| Returns the value for the key resource. More... | |
| def | get_winfo (self, key) |
| Returns the widget info for the item key. More... | |
| def | has_option (self, opt=None) |
| Returns True if the widget admits the given option. More... | |
| def | parent (self) |
| Returns the widget parent. More... | |
| def | toplevel (self) |
| Returns the widget toplevel container (a Window or Main). More... | |
| def | unbind (self, sequence, funcid=None) |
| Redefines the tk.Misc.unbind() method. More... | |
| def | winfo_bh (self) |
| Returns the height of the widget bounding box. More... | |
| def | winfo_bpad (self) |
| Returns the list of the four pad amounts (E-N-W-S) of the widget with respect to its bounding box. More... | |
| def | winfo_bw (self) |
| Returns the width of the widget bounding box. More... | |
| def | winfo_bx (self) |
| Returns the x coordinate of the widget bounding box topleft corner. More... | |
| def | winfo_by (self) |
| Returns the y coordinate of the widget bounding box topleft corner. More... | |
| def | winfo_height (self) |
| Returns the widget height. More... | |
| def | winfo_width (self) |
| Returns the widget width. More... | |
| def | winfo_x (self) |
| Returns the x coordinate of the topleft corner of the widget with respect to the parent. More... | |
| def | winfo_y (self) |
| Returns the y coordinate of the topleft corner of the widget with respect to the parent. More... | |
Additional Inherited Members | |
Static Public Attributes inherited from Misc | |
| def | winfo_h = winfo_height |
| Alias for winfo_height() More... | |
| def | winfo_w = winfo_width |
| Alias for winfo_width() More... | |
Menu widget which allows displaying menu bars, pull-down menus and pop-up menus.
**Common options** (see \ref ATTRIBUTES)
abcolor, afcolor, bcolor, borderwidth, cursor, dfcolor, font, fcolor, relief,
sfcolor, takefocus
**Less common options**
activeborderwidth, postcommand, tearoff, tearoffcommand, title, type
see <a href="https://anzeljg.github.io/rin2/book2/2405/docs/tkinter/menu.html">anzeljg reference</a>
for the class **tkinter.Menu**
\see \ref Menu.py example file
| def __init__ | ( | self, | |
| parent, | |||
label = None, |
|||
popup = False |
|||
| ) |
The constructor.
It creates an empty menu, and you can add to it commands, checkbuttons, radiobuttons and separators.
| parent | the menu parent; if it is an instance of Menu this menu will be added to it as a cascade, if it is a window this is set as its menubar (but see below) |
| label | the menu text |
| popup | if True this is a popup menu, and will not be added to its parent |
| def activate | ( | self | ) |
Sets the state of the menu to NORMAL.
The menu and all its submenus can interact with mouse and keyboard.
| def add | ( | self, | |
| itemType, | |||
cnf = {}, |
|||
| ** | kw | ||
| ) |
Appends an item to the menu.
It overrides tkinter method. You, however, can continue to use add_command(), add_checkbutton(), add_radiobutton() and add_separator() (see the tkinter reference).
| def clear | ( | self | ) |
Deletes all menu items.
| def deactivate | ( | self | ) |
Sets the state of the menu to DISABLED.
The menu and all its submenus are grayed and cannot interact with mouse and keyboard.
| def delete | ( | self, | |
| index1, | |||
index2 = None |
|||
| ) |
Deletes menu items between index1 and index2 (included).
| def entry_activate | ( | self, | |
| index | |||
| ) |
Sets the state of the menu item denoted by index to NORMAL.
The menu item and all its submenus can interact with mouse and keyboard.
| index | can be the label of the menu item or its index in the menu array. |
| def entry_config | ( | self, | |
| index, | |||
cnf = None, |
|||
| ** | kw | ||
| ) |
Configures a menu item at index.
| def entry_deactivate | ( | self, | |
| index | |||
| ) |
Sets the state of the menu item denoted by index to DISABLED.
The menu item and all its submenus are grayed and cannot interact with mouse and keyboard.
| index | can be the label of the menu item or its index in the menu array. |
| def entry_get_config | ( | self, | |
| index, | |||
| option | |||
| ) |
Returns the resource value of a menu item.
| index | the item index as an int (starting from 0) |
| option | the option we wantto know as a string |
| def entry_set_variable | ( | self, | |
| index, | |||
variable = None, |
|||
offvalue = None, |
|||
onvalue = None |
|||
| ) |
Sets a variable for the menu at index.
It is useful only for checkbutton items.
| def insert | ( | self, | |
| index, | |||
| itemType, | |||
cnf = {}, |
|||
| ** | kw | ||
| ) |
Inserts an item in the menu at the given index (starting from 0).
It overrides tkinter method. You, however, can continue to use insert_command(), insert_checkbutton(), insert_radiobutton() and insert_separator() (see the tkinter reference).
| def size | ( | self | ) |
Returns the number of elements in the items list.