Combo
ComboBox Element - A combination of a single-line input and a drop-down menu. User can type in their own value or choose from list.
Combo(
values,
default_value = None,
size = (None, None),
auto_size_text = None,
background_color = None,
text_color = None,
change_submits = False,
enable_events = False,
disabled = False,
key = None,
pad = None,
tooltip = None,
readonly = False,
visible_items = 10,
font = None,
auto_complete = True,
visible = True,
size_px = (None, None)
)
Parameter Descriptions
Name | Type | Default | Description |
---|---|---|---|
auto_complete | bool | True | Turn on auto complete |
auto_size_text | bool | None | True if element should be the same size as the contents |
background_color | str | None | color of background. Can be in #RRGGBB format or a color name "black" |
change_submits | bool | False | DEPRICATED DO NOT USE. Use enable_events instead |
default_value | Any | None | Choice to be displayed as initial value. Must match one of values variable contents |
disabled | bool | False | set disable state for element |
enable_events | bool | False | Turns on the element specific events. Combo event is when a choice is made |
font | (str or (str, int[, str]) or None) | None | specifies the font family, size, etc. Tuple or Single string format 'name size styles'. Styles: italic * roman bold normal underline overstrike |
key | str or int or tuple or object | None | Used with window.find_element and with return values to uniquely identify this element |
pad | (int, int or (int, int),(int,int) or int,(int,int)) or ((int, int),int) or int | None | 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) |
readonly | bool | False | make element readonly (user can't change). True means user cannot change |
size | (int, int) or (None, None) | (None, None) | width, height. Width = characters-wide, height = NOTE it's the number of entries to show in the list. |
size_px | (int, int) or (None, None) | (None, None) | w=pixels-wide, h=pixels-high |
text_color | str | None | element's text color. Can be in #RRGGBB format or a color name "black" |
tooltip | str | None | text that will appear when mouse hovers over this element |
values | List[Any] or Tuple[Any] | values to choose. While displayed as text, the items returned are what the caller supplied, not text | |
visible | bool | True | set visibility state of the element |
visible_items | int | 10 | Amount of visible items |
Class Properties
This class has no public properties
Class Methods
def update
update
Changes some of the settings for the Combo Element. Must call Window.Read
or Window.Finalize
prior.
Note that the state can be in 3 states only.... enabled, disabled, readonly even
though more combinations are available. The easy way to remember is that if you
change the readonly parameter then you are enabling the element.
Changes will not be visible in your window until you call window.read or window.refresh.
If you change visibility, your element may MOVE. If you want it to remain stationary, use the "layout helper" function "pin" to ensure your element is "pinned" to that location in your layout so that it returns there when made visible.
update(
value = None,
values = None,
set_to_index = None,
disabled = None,
readonly = None,
background_color = None,
text_color = None,
font = None,
visible = None
)
Parameter Descriptions
Name | Type | Default | Description |
---|---|---|---|
background_color | str | None | color of background. Can be in #RRGGBB format or a color name "black" |
disabled | bool | None | disable or enable state of the element |
font | (str or (str, int[, str]) or None) | None | specifies the font family, size, etc. Tuple or Single string format 'name size styles'. Styles: italic * roman bold normal underline overstrike |
readonly | bool | None | if True make element readonly (user cannot change any choices). Enables the element if either choice are made. |
set_to_index | int | None | change selection to a particular choice starting with index = 0 |
text_color | str | None | element's text color. Can be in #RRGGBB format or a color name "black" |
value | Any | None | change which value is current selected based on new list of previous list of choices |
values | List[Any] | None | change list of choices |
visible | bool | None | control visibility of element |