GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing docs.wxpython.org — wx.ComboBox — wxPython 4.3.2 Docs
|
Default constructor. |
|
Creates the combobox for two-step construction. |
|
Hides the list box portion of the combo box. |
|
Finds an item whose label matches the given string. |
|
Returns the number of items in the control. |
|
Returns the item being selected right now. |
|
Same as |
|
Returns the index of the selected item or |
|
Gets the current selection span. |
|
Returns the label of the item with the given index. |
|
Gets the text currently selected in the control. |
|
Returns |
|
Returns |
|
Shows the list box portion of the combo box. |
|
Same as |
|
Changes the text of the specified combobox item. |
|
Same as |
|
Sets the text for the combobox text field. |
Properties Summary¶See |
|
See |
|
Class API¶Possible constructors:
ComboBox() -> None ComboBox(parent, id=ID_ANY, value='', pos=DefaultPosition, size=DefaultSize, choices=[], style=0, validator=DefaultValidator, name=ComboBoxNameStr) -> None
A combobox is like a combination of an edit control and a listbox.
__init__ (self)
Default constructor.
None
__init__ (self, parent, id=ID_ANY, value=’’, pos=DefaultPosition, size=DefaultSize, choices=[], style=0, validator=DefaultValidator, name=ComboBoxNameStr)
Constructor, creating and showing a combobox.
parent (wx.Window) – Parent window. Must not be nullptr.
id (wx.WindowID) – Window identifier. The value wx.ID_ANY indicates a default value.
value (string) – Initial selection string. An empty string indicates no selection.
pos (wx.Point) – Window position.
size (wx.Size) – Window size. If DefaultSize is specified then the window is sized appropriately.
choices (list of strings) – An array of strings with which to initialise the control.
style (long) – Window style. See wx.ComboBox.
validator (wx.Validator) – Window validator.
name (string) – Window name.
None
Creates the combobox for two-step construction.
Derived classes should call or replace this function. See wx.ComboBox for further details.
parent (wx.Window)
id (wx.WindowID)
value (string)
pos (wx.Point)
size (wx.Size)
choices (list of strings)
style (long)
validator (wx.Validator)
name (string)
bool
Hides the list box portion of the combo box.
Currently this method is implemented in wxMSW, wxGTK and OSX/Cocoa.
Notice that calling this function will generate a wxEVT_COMBOBOX_CLOSEUP event except under wxOSX where generation of this event is not supported at all.
None
Added in version 2.9.1.
Finds an item whose label matches the given string.
string (string) – String to find.
caseSensitive (bool) – Whether search is case sensitive (default is not).
int
The zero-based position of the item, or wx.NOT_FOUND if the string was not found.
variant (WindowVariant)
Returns the item being selected right now.
This function does the same things as wx.Choice.GetCurrentSelection and returns the item currently selected in the dropdown list if it’s open or the same thing as wx.ControlWithItems.GetSelection otherwise.
int
Same as wx.TextEntry.GetInsertionPoint .
int
Note
Under wxMSW, this function always returns 0 if the combobox doesn’t have the focus.
Returns the index of the selected item or NOT_FOUND if no item is selected.
int
The position of the current selection.
See also
Gets the current selection span.
If the returned values are equal, there was no selection. Please note that the indices returned may be used with the other wx.TextCtrl methods but don’t necessarily represent the correct indices into the string returned by GetValue for multiline controls under Windows (at least,) you should use GetStringSelection to get the selected text.
Tuple[int, int]
Returns the label of the item with the given index.
The index must be valid, i.e. less than the value returned by GetCount , otherwise an assert is triggered. Notably, this function can’t be called if the control is empty.
n (int) – The zero-based index.
str
The label of the item.
Gets the text currently selected in the control.
If there is no selection, the returned string is empty.
str
Returns True if the list of combobox choices is empty.
Use this method instead of (not available in this class) IsEmpty to test if the list of items is empty.
bool
Added in version 2.9.3.
Returns True if the text of the combobox is empty.
Use this method instead of (not available in this class) IsEmpty to test if the text currently entered into the combobox is empty.
bool
Added in version 2.9.3.
Shows the list box portion of the combo box.
Currently this method is implemented in wxMSW, wxGTK and OSX/Cocoa.
Notice that calling this function will generate a wxEVT_COMBOBOX_DROPDOWN event except under wxOSX where generation of this event is not supported at all.
None
Added in version 2.9.1.
SetSelection (self, from_, to_)
Same as wx.TextEntry.SetSelection .
from_ (long)
to_ (long)
None
SetSelection (self, n)
Sets the selection to the given item n or removes the selection entirely if n == NOT_FOUND .
Note that this does not cause any command events to be emitted nor does it deselect any other items in the controls which support multiple selections.
n (int) – The string position to select, starting from zero.
None
See also
SetString , SetStringSelection
Changes the text of the specified combobox item.
Notice that if the item is the currently selected one, i.e. if its text is displayed in the text part of the combobox, then the text is also replaced with the new text.
n (int)
text (string)
None
Same as wx.TextEntry.SetSelection .
from_ (long)
to_ (long)
None
Sets the text for the combobox text field.
For normal, editable comboboxes with a text entry field calling this method will generate a wxEVT_TEXT event, consistently with wx.TextEntry.SetValue behaviour, use wx.TextEntry.ChangeValue if this is undesirable.
For controls with CB_READONLY style the method behaves somewhat differently: the string must be in the combobox choices list (the check for this is case-insensitive) and wxEVT_TEXT is not generated in this case.
text (string) – The text to set.
None
See GetSelection and SetSelection