:param values: Values to be displayed :type values: List[Any] or Tuple[Any] :param default_value: the value to choose by default :type default_value: (Any) :param size: (width, height) size in characters (wide), height
(self, values, default_value=None, size=(None, None), s=(None, None), disabled=False, enable_events=False, auto_size_text=None, expand_x=False, expand_y=False,
background_color=None, text_color=None, key=None, k=None, pad=None, p=None, tooltip=None, visible=True, metadata=None)
| 2515 | """ |
| 2516 | |
| 2517 | def __init__(self, values, default_value=None, size=(None, None), s=(None, None), disabled=False, enable_events=False, auto_size_text=None, expand_x=False, expand_y=False, |
| 2518 | background_color=None, text_color=None, key=None, k=None, pad=None, p=None, tooltip=None, visible=True, metadata=None): |
| 2519 | """ |
| 2520 | :param values: Values to be displayed |
| 2521 | :type values: List[Any] or Tuple[Any] |
| 2522 | :param default_value: the value to choose by default |
| 2523 | :type default_value: (Any) |
| 2524 | :param size: (width, height) size in characters (wide), height is ignored and present to be consistent with other elements |
| 2525 | :type size: (int, int) (width, UNUSED) |
| 2526 | :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 |
| 2527 | :type s: (int, int) | (None, None) | int |
| 2528 | :param disabled: control enabled / disabled |
| 2529 | :type disabled: (bool) |
| 2530 | :param enable_events: Turns on the element specific events. OptionMenu event is when a choice is made |
| 2531 | :type enable_events: (bool) |
| 2532 | :param auto_size_text: True if size of Element should match the contents of the items |
| 2533 | :type auto_size_text: (bool) |
| 2534 | :param expand_x: If True the element will automatically expand in the X direction to fill available space |
| 2535 | :type expand_x: (bool) |
| 2536 | :param expand_y: If True the element will automatically expand in the Y direction to fill available space |
| 2537 | :type expand_y: (bool) |
| 2538 | :param background_color: color of background |
| 2539 | :type background_color: (str) |
| 2540 | :param text_color: color of the text |
| 2541 | :type text_color: (str) |
| 2542 | :param key: Used with window.find_element and with return values to uniquely identify this element |
| 2543 | :type key: str | int | tuple | object |
| 2544 | :param k: Same as the Key. You can use either k or key. Which ever is set will be used. |
| 2545 | :type k: str | int | tuple | object |
| 2546 | :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) |
| 2547 | :type pad: (int, int) or ((int, int),(int,int)) or (int,(int,int)) or ((int, int),int) | int |
| 2548 | :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 |
| 2549 | :type p: (int, int) or ((int, int),(int,int)) or (int,(int,int)) or ((int, int),int) | int |
| 2550 | :param tooltip: text that will appear when mouse hovers over this element |
| 2551 | :type tooltip: (str) |
| 2552 | :param visible: set visibility state of the element |
| 2553 | :type visible: (bool) |
| 2554 | :param metadata: User metadata that can be set to ANYTHING |
| 2555 | :type metadata: (Any) |
| 2556 | """ |
| 2557 | |
| 2558 | self.Values = values |
| 2559 | self.DefaultValue = default_value |
| 2560 | self.Widget = self.TKOptionMenu = None # type: tk.OptionMenu |
| 2561 | self.Disabled = disabled |
| 2562 | bg = background_color if background_color else DEFAULT_INPUT_ELEMENTS_COLOR |
| 2563 | fg = text_color if text_color is not None else DEFAULT_INPUT_TEXT_COLOR |
| 2564 | key = key if key is not None else k |
| 2565 | sz = size if size != (None, None) else s |
| 2566 | pad = pad if pad is not None else p |
| 2567 | self.expand_x = expand_x |
| 2568 | self.expand_y = expand_y |
| 2569 | self.ChangeSubmits = enable_events |
| 2570 | |
| 2571 | super().__init__(ELEM_TYPE_INPUT_OPTION_MENU, size=sz, auto_size_text=auto_size_text, background_color=bg, |
| 2572 | text_color=fg, key=key, pad=pad, tooltip=tooltip, visible=visible, metadata=metadata) |
| 2573 | |
| 2574 | def update(self, value=None, values=None, disabled=None, visible=None, size=(None, None)): |