*********************** wx.combo.BitmapComboBox *********************** Inheritance diagram for `wx.combo.BitmapComboBox`: | .. inheritance-diagram:: wx.combo.BitmapComboBox | Description =========== 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. .. seealso:: `wx.ComboBox <../Widgets/wx.ComboBox.html>`_, `wx.Choice <../Widgets/wx.Choice.html>`_, `wx.combo.OwnerDrawnComboBox `_, `wx.CommandEvent <../Events/wx.CommandEvent.html>`_ Derived From ^^^^^^^^^^^^^ * `wx.ComboBox <../Widgets/wx.ComboBox.html>`_ * `wx.ControlWithItems <../Widgets/wx.ControlWithItems.html>`_ * `wx.Control <../Widgets/wx.Control.html>`_ * `wx.Window <../Widgets/wx.Window.html>`_ * `wx.EvtHandler <../Widgets/wx.EvtHandler.html>`_ * `wx.Object <../Widgets/wx.Object.html>`_ Remarks ^^^^^^^ While `wx.BitmapComboBox` contains the `wx.ComboBox <../Widgets/wx.ComboBox.html>`_ API, but it might not actually be derived from that class. In fact, if the platform does not have a native implementation, `wx.BitmapComboBox` will inherit from `wx.combo.OwnerDrawnComboBox `_. You can determine if the implementation is generic by checking whether ``wx.GENERIC_BITMAPCOMBOBOX`` is defined. Window Styles ^^^^^^^^^^^^^ ================================================== ================================================== Window Style Description ================================================== ================================================== ``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 Handling ^^^^^^^^^^^^^^ ================================================== ================================================== Event Name Description ================================================== ================================================== wx.EVT_COMBOBOX(id, func) Process a ``wx.wxEVT_COMMAND_COMBOBOX_SELECTED`` event, when an item on the list is selected. 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 ``RETURN`` is pressed in the combobox. ================================================== ================================================== | Control Appearance ^^^^^^^^^^^^^^^^^^ | .. figure:: ../images/wxWidgets/wxmsw/bitmapcombobox.png :alt: wxMSW :figclass: floatleft **wxMSW** .. figure:: ../images/wxWidgets/wxmac/bitmapcombobox.png :alt: wxMAC :figclass: floatright **wxMAC** .. figure:: ../images/wxWidgets/wxgtk/bitmapcombobox.png :alt: wxGTK :figclass: floatcenter **wxGTK** | Methods Summary ^^^^^^^^^^^^^^^ * `__init__ <#__init__>`_ * `Append <#Append>`_ * `Create <#Create>`_ * `GetBitmapSize <#GetBitmapSize>`_ * `GetItemBitmap <#GetItemBitmap>`_ * `Insert <#Insert>`_ * `SetItemBitmap <#SetItemBitmap>`_ Class API ========= Methods ^^^^^^^ .. method:: __init__(parent, id=-1, value="", pos=wx.DefaultPosition, size=wx.DefaultSize, choices=[], style=0, validator=wx.DefaultValidator, name=wx.BitmapComboBoxNameStr) Standard constructor. **Parameters:** * `parent` (`wx.Window <../Widgets/wx.Window.html>`_) * `id` (int) * `value` (string) * `pos` (`wx.Point <../Widgets/wx.Point.html>`_) * `size` (`wx.Size <../Widgets/wx.Size.html>`_) * `choices` (list of strings) * `style` (long) * `validator` (`wx.Validator <../Widgets/wx.Validator.html>`_) * `name` (string) | **Returns:** `wx.combo.BitmapComboBox `_ -------- .. method:: Append(item, bitmap=wx.NullBitmap, clientData=None) Adds the item to the end of the combo box, associating the given, typed or untyped, client data pointer with the item. **Parameters:** * `item` (string): The item name. * `bitmap` (`wx.Bitmap <../Widgets/wx.Bitmap.html>`_): The bitmap associated with this item. * `clientData` (PyObject): The item data. | **Returns:** `int` -------- .. method:: Create(parent, id=-1, value="", pos=wx.DefaultPosition, size=wx.DefaultSize, choices=[], style=0, validator=wx.DefaultValidator, name=wx.BitmapComboBoxNameStr) Creates the combobox for two-step construction. Derived classes should call or replace this function. **Parameters:** * `parent` (`wx.Window <../Widgets/wx.Window.html>`_) * `id` (int) * `value` (string) * `pos` (`wx.Point <../Widgets/wx.Point.html>`_) * `size` (`wx.Size <../Widgets/wx.Size.html>`_) * `choices` (list of strings) * `style` (long) * `validator` (`wx.Validator <../Widgets/wx.Validator.html>`_) * `name` (string) | **Returns:** `bool` .. seealso:: `__init__ <#__init__>`_ -------- .. method:: GetBitmapSize() Returns size of bitmaps used in the list. | **Returns:** `wx.Size <../Widgets/wx.Size.html>`_ -------- .. method:: GetItemBitmap(n) Returns the bitmap of the item with the given index. **Parameters:** * `n` (unsigned int) | **Returns:** `wx.Bitmap <../Widgets/wx.Bitmap.html>`_ -------- .. method:: Insert(item, bitmap, pos, clientData=None) Inserts the item into the list before `pos`, associating the given, typed or untyped, client data pointer with the item. Not valid for ``wx.CB_SORT`` style, use `Append <#Append>`_ instead. **Parameters:** * `item` (string): The item name. * `bitmap` (`wx.Bitmap <../Widgets/wx.Bitmap.html>`_): The bitmap associated with this item. * `pos` (int): the item position. * `clientData` (PyObject): The item data. | **Returns:** `int` -------- .. method:: SetItemBitmap(n, bitmap) Sets the bitmap for the given item. **Parameters:** * `n` (unsigned int) * `bitmap` (`wx.Bitmap <../Widgets/wx.Bitmap.html>`_)