********* wx.Choice ********* Inheritance diagram for `wx.Choice`: | .. inheritance-diagram:: wx.Choice | Description =========== A choice item is used to select one of a list of strings. Unlike a listbox, only the selection is visible until the user pulls down the menu of choices. .. seealso:: `wx.ListBox `_, `wx.ComboBox `_, `wx.CommandEvent <../Events/wx.CommandEvent.html>`_ Derived From ^^^^^^^^^^^^^ * `wx.ControlWithItems `_ * `wx.Control `_ * `wx.Window `_ * `wx.EvtHandler `_ * `wx.Object `_ Known Subclasses ^^^^^^^^^^^^^^^^ `wx.ComboBox `_, `wx.DirFilterListCtrl `_ Event Handling ^^^^^^^^^^^^^^ ================================================== ================================================== Event Name Description ================================================== ================================================== wx.EVT_CHOICE(id, func) Process a ``wx.wxEVT_COMMAND_CHOICE_SELECTED`` event, when an item on the list is selected. ================================================== ================================================== | Control Appearance ^^^^^^^^^^^^^^^^^^ | .. figure:: ../images/wxWidgets/wxmsw/choice.png :alt: wxMSW :figclass: floatleft **wxMSW** .. figure:: ../images/wxWidgets/wxmac/choice.png :alt: wxMAC :figclass: floatright **wxMAC** .. figure:: ../images/wxWidgets/wxgtk/choice.png :alt: wxGTK :figclass: floatcenter **wxGTK** | Methods Summary ^^^^^^^^^^^^^^^ * `__init__ <#__init__>`_ * `GetCurrentSelection <#GetCurrentSelection>`_ Properties Summary ^^^^^^^^^^^^^^^^^^ * `CurrentSelection <#CurrentSelection>`_ Class API ========= Methods ^^^^^^^ .. method:: __init__(parent, id, pos=wx.DefaultPosition, size=wx.DefaultSize, choices=[], style=0, validator=wx.DefaultValidator, name=wx.ChoiceNameStr) Create and show a `wx.Choice` control. **Parameters:** * `parent` (`wx.Window `_) * `id` (int) * `pos` (`wx.Point `_) * `size` (`wx.Size `_) * `choices` (list of strings) * `style` (long) * `validator` (`wx.Validator `_) * `name` (string) | **Returns:** `wx.Choice `_ -------- .. method:: GetCurrentSelection() Unlike `GetSelection `_ which only returns the accepted selection value, i.e. the selection in the control once the user closes the dropdown list, this function returns the current selection. That is, while the dropdown list is shown, it returns the currently selected item in it. When it is not shown, its result is the same as for the other function. This function is new since wxWidgets version 2.6.2 (before this version `GetSelection `_ itself behaved like this). | **Returns:** `int` -------- Properties ^^^^^^^^^^ .. attribute:: CurrentSelection See `GetCurrentSelection <#GetCurrentSelection>`_