Inheritance diagram for wx.ComboBox:
A combobox is like a combination of an edit control and a listbox. It can be displayed as static list with editable or read-only text field; or a drop-down list with text field; or a drop-down list without a text field.
A combobox permits a single selection only. Combobox items are numbered from zero.
If you need a customized combobox, have a look at:
See also
Window Style | Description |
---|---|
wx.CB_SIMPLE | Creates a combobox with a permanently displayed list. Windows only. |
wx.CB_DROPDOWN | Creates a combobox with a drop-down list. |
wx.CB_READONLY | Same as wx.CB_DROPDOWN but only the strings specified as the combobox choices can be selected, it is impossible to select (even from a program) a string which is not in the choices list. |
wx.CB_SORT | Sorts the entries in the list alphabetically. |
wx.TE_PROCESS_ENTER | The control will generate the event wx.EVT_COMMAND_TEXT_ENTER (otherwise pressing Enter key is either processed internally by the control or used for navigation between dialog controls). Windows only. |
Event Name | Description |
---|---|
wx.EVT_COMBOBOX(id, func) | Process a wx.wxEVT_COMMAND_COMBOBOX_SELECTED event, when an item on the list is selected. Note that calling GetValue returns the new value of selection. |
wx.EVT_TEXT(id, func) | Process a wx.wxEVT_COMMAND_TEXT_UPDATED event, when the combobox text changes. |
wx.EVT_TEXT_ENTER(id, func) | Process a wx.wxEVT_COMMAND_TEXT_ENTER event, when Enter is pressed in the combobox. |
Constructor, creates and shows a wx.ComboBox control.
Parameters:
Returns:
Returns True if the combobox is editable and there is a text selection to copy to the clipboard. Only available on Windows.
Returns:
bool
Returns True if the combobox is editable and there is a text selection to copy to the clipboard. Only available on Windows.
Returns:
bool
Returns True if the combobox is editable and there is text on the clipboard that can be pasted into the text field. Only available on Windows.
Returns:
bool
Returns True if the combobox is editable and the last undo can be redone. Only available on Windows.
Returns:
bool
Returns True if the combobox is editable and the last edit can be undone. Only available on Windows.
Returns:
bool
Returns the insertion point for the combobox’s text field.
Returns:
long
Note
Under wxMSW, this function always returns 0 if the combobox doesn’t have the focus.
Returns the last position in the combobox text field.
Returns:
int
Gets the positions of the begining and ending of the selection mark in the combobox text field.
Returns:
(from, to)
Returns the current value in the combobox text field.
Returns:
string
Returns True if the combo is editable (not read-only).
Returns:
bool
Removes the text between the two positions in the combobox text field.
Parameters:
Replaces the text between two positions with the given text, in the combobox text field.
Parameters:
Sets the combobox as editable.
Parameters:
Sets the insertion point in the combobox text field.
Parameters:
Selects the text between the two positions in the combobox text field.
Parameters:
Sets the text for the combobox text field.
Parameters:
Note
For a combobox with wx.CB_READONLY style the string must be in the combobox choices list, otherwise the call to SetValue() is ignored.