:param menu_definition: The Menu definition specified using lists (docs explain the format) :type menu_definition: List[List[Tuple[str, List[str]]] :param background_color: color of the background of menus, NOT the Menubar :type backgrou
(self, menu_definition, background_color=None, text_color=None, disabled_text_color=None, size=(None, None), s=(None, None), tearoff=False,
font=None, pad=None, p=None, key=None, k=None, visible=True, metadata=None)
| 8552 | """ |
| 8553 | |
| 8554 | def __init__(self, menu_definition, background_color=None, text_color=None, disabled_text_color=None, size=(None, None), s=(None, None), tearoff=False, |
| 8555 | font=None, pad=None, p=None, key=None, k=None, visible=True, metadata=None): |
| 8556 | """ |
| 8557 | :param menu_definition: The Menu definition specified using lists (docs explain the format) |
| 8558 | :type menu_definition: List[List[Tuple[str, List[str]]] |
| 8559 | :param background_color: color of the background of menus, NOT the Menubar |
| 8560 | :type background_color: (str) |
| 8561 | :param text_color: text color for menus, NOT the Menubar. Can be in #RRGGBB format or a color name "black". |
| 8562 | :type text_color: (str) |
| 8563 | :param disabled_text_color: color to use for text when item in submenu, not the menubar itself, is disabled. Can be in #RRGGBB format or a color name "black" |
| 8564 | :type disabled_text_color: (str) |
| 8565 | :param size: Not used in the tkinter port |
| 8566 | :type size: (int, int) |
| 8567 | :param s: Same as size parameter. It's an alias. If EITHER of them are set, then the one that's set will be used. If BOTH are set, size will be used |
| 8568 | :type s: (int, int) | (None, None) |
| 8569 | :param tearoff: if True, then can tear the menu off from the window ans use as a floating window. Very cool effect |
| 8570 | :type tearoff: (bool) |
| 8571 | :param pad: Amount of padding to put around element in pixels (left/right, top/bottom) or ((left, right), (top, bottom)) or an int. If an int, then it's converted into a tuple (int, int) |
| 8572 | :type pad: (int, int) or ((int, int),(int,int)) or (int,(int,int)) or ((int, int),int) | int |
| 8573 | :param p: Same as pad parameter. It's an alias. If EITHER of them are set, then the one that's set will be used. If BOTH are set, pad will be used |
| 8574 | :type p: (int, int) or ((int, int),(int,int)) or (int,(int,int)) or ((int, int),int) | int |
| 8575 | :param font: specifies the font family, size, etc. of submenus. Does NOT apply to the Menubar itself. Tuple or Single string format 'name size styles'. Styles: italic * roman bold normal underline overstrike |
| 8576 | :type font: (str or (str, int[, str]) or None) |
| 8577 | :param key: Value that uniquely identifies this element from all other elements. Used when Finding an element or in return values. Must be unique to the window |
| 8578 | :type key: str | int | tuple | object |
| 8579 | :param k: Same as the Key. You can use either k or key. Which ever is set will be used. |
| 8580 | :type k: str | int | tuple | object |
| 8581 | :param visible: set visibility state of the element |
| 8582 | :type visible: (bool) |
| 8583 | :param metadata: User metadata that can be set to ANYTHING |
| 8584 | :type metadata: (Any) |
| 8585 | """ |
| 8586 | |
| 8587 | self.BackgroundColor = background_color if background_color is not None else theme_input_background_color() |
| 8588 | self.TextColor = text_color if text_color is not None else theme_input_text_color() |
| 8589 | |
| 8590 | self.DisabledTextColor = disabled_text_color if disabled_text_color is not None else COLOR_SYSTEM_DEFAULT |
| 8591 | self.MenuDefinition = copy.deepcopy(menu_definition) |
| 8592 | self.Widget = self.TKMenu = None # type: tk.Menu |
| 8593 | self.MenuItemChosen = None |
| 8594 | key = key if key is not None else k |
| 8595 | sz = size if size != (None, None) else s |
| 8596 | pad = pad if pad is not None else p |
| 8597 | |
| 8598 | super().__init__(ELEM_TYPE_MENUBAR, background_color=self.BackgroundColor, text_color=self.TextColor, size=sz, pad=pad, key=key, visible=visible, |
| 8599 | font=font, metadata=metadata) |
| 8600 | # super().__init__(ELEM_TYPE_MENUBAR, background_color=COLOR_SYSTEM_DEFAULT, text_color=COLOR_SYSTEM_DEFAULT, size=sz, pad=pad, key=key, visible=visible, font=None, metadata=metadata) |
| 8601 | |
| 8602 | self.Tearoff = tearoff |
| 8603 | |
| 8604 | return |
| 8605 | |
| 8606 | def _MenuItemChosenCallback(self, item_chosen): # Menu Menu Item Chosen Callback |
| 8607 | """ |
nothing calls this directly
no test coverage detected