A combobox that displays bitmap in front of the list items.
It currently only allows using bitmaps of one size, and resizes itself so that a bitmap can be shown next to the text field.
This class supports the following styles:
wx.CB_READONLY
: Creates a combobox without a text editor. On some platforms the control may appear very different when this style is used.wx.CB_SORT
: Sorts the entries in the list alphabetically.wx.TE_PROCESS_ENTER
: The control will generate the event wxEVT_TEXT_ENTER (otherwise pressing Enter key is either processed internally by the control or used for navigation between dialog controls). Windows only.Handlers bound for the following event types will receive a wx.CommandEvent parameter.
wxEVT_COMBOBOX
event, when an item on the list is selected.wxEVT_TEXT
event, when the combobox text changes.wxEVT_TEXT_ENTER
event, when RETURN
is pressed in the combobox.Note
While wx.adv.BitmapComboBox contains the wx.ComboBox API, but it might not actually be derived from that class. In fact, if the platform does not have a native implementation, wx.adv.BitmapComboBox will inherit from wx.adv.OwnerDrawnComboBox. You can determine if the implementation is generic by checking whether GENERIC_BITMAPCOMBOBOX
is defined. Currently wx.adv.BitmapComboBox is implemented natively for MSW and GTK+.
See also
wx.ComboBox, wx.Choice, wx.adv.OwnerDrawnComboBox, wx.CommandEvent
Todo
create CB_PROCESS_ENTER
rather than reusing wx.TE_PROCESS_ENTER
!
__init__ |
Default constructor. |
Append |
Adds the item to the end of the combo box. |
Create |
Creates the combobox for two-step construction. |
GetBitmapSize |
Returns the size of the bitmaps used in the combo box. |
GetItemBitmap |
Returns the bitmap of the item with the given index. |
Insert |
Inserts the item into the list before pos. |
SetItemBitmap |
Sets the bitmap for the given item. |
wx.adv.
BitmapComboBox
(Control, TextEntry, ItemContainer)¶Possible constructors:
BitmapComboBox()
BitmapComboBox(parent, id=ID_ANY, value="", pos=DefaultPosition,
size=DefaultSize, choices=[], style=0, validator=DefaultValidator,
name=BitmapComboBoxNameStr)
A combobox that displays bitmap in front of the list items.
__init__
(self, *args, **kw)¶__init__ (self)
Default constructor.
__init__ (self, parent, id=ID_ANY, value=””, pos=DefaultPosition, size=DefaultSize, choices=[], style=0, validator=DefaultValidator, name=BitmapComboBoxNameStr)
Constructor, creating and showing a combobox.
Parameters: |
|
---|
See also
Append
(self, *args, **kw)¶Append (self, item, bitmap=NullBitmap)
Adds the item to the end of the combo box.
Parameters: |
|
---|---|
Return type: | int |
Append (self, item, bitmap, clientData)
Adds the item to the end of the combo box, associating the given typed client data pointer clientData with the item.
Parameters: |
|
---|---|
Return type: | int |
Create
(self, parent, id=ID_ANY, value="", pos=DefaultPosition, size=DefaultSize, choices=[], style=0, validator=DefaultValidator, name=BitmapComboBoxNameStr)¶Creates the combobox for two-step construction.
Parameters: |
|
---|---|
Return type: | bool |
GetBitmapSize
(self)¶Returns the size of the bitmaps used in the combo box.
If the combo box is empty, then wx.DefaultSize
is returned.
Return type: | Size |
---|
GetItemBitmap
(self, n)¶Returns the bitmap of the item with the given index.
Parameters: | n (int) – |
---|---|
Return type: | Bitmap |
Insert
(self, *args, **kw)¶Insert (self, item, bitmap, pos)
Inserts the item into the list before pos.
Not valid for CB_SORT
style, use Append
instead.
Parameters: |
|
---|---|
Return type: | int |
Insert (self, item, bitmap, pos, clientData)
Inserts the item into the list before pos, associating the given typed client data pointer with the item.
Not valid for CB_SORT
style, use Append
instead.
Parameters: |
|
---|---|
Return type: | int |
SetItemBitmap
(self, n, bitmap)¶Sets the bitmap for the given item.
Parameters: |
|
---|
BitmapSize
¶See GetBitmapSize