.. wxPython Phoenix documentation This file was generated by Phoenix's sphinx generator and associated tools, do not edit by hand. Copyright: (c) 2011-2020 by Total Control Software License: wxWindows License .. include:: headings.inc .. _wx.CheckListBox: ========================================================================================================================================== |phoenix_title| **wx.CheckListBox** ========================================================================================================================================== A :ref:`wx.CheckListBox` is like a :ref:`wx.ListBox`, but allows items to be checked or unchecked. When using this class under Windows wxWidgets must be compiled with ``USE_OWNER_DRAWN`` set to 1. ^^ .. _CheckListBox-events: |events| Events Emitted by this Class ===================================== Handlers bound for the following event types will receive a :ref:`wx.CommandEvent` parameter. - EVT_CHECKLISTBOX: Process a ``wxEVT_CHECKLISTBOX`` event, when an item in the check list box is checked or unchecked. :meth:`wx.CommandEvent.GetInt` will contain the index of the item that was checked or unchecked. :meth:`wx.CommandEvent.IsChecked` is not valid! Use :meth:`wx.CheckListBox.IsChecked` instead. ^^ .. seealso:: :ref:`wx.ListBox`, :ref:`wx.Choice`, :ref:`wx.ComboBox`, :ref:`wx.ListCtrl`, :ref:`wx.CommandEvent` | |class_hierarchy| Class Hierarchy ================================= .. raw:: html
Inheritance diagram for class CheckListBox:
| |appearance| Control Appearance =============================== | .. figure:: _static/images/widgets/fullsize/wxmsw/wx.checklistbox.png :alt: wxMSW :figclass: floatleft **wxMSW** .. figure:: _static/images/widgets/fullsize/wxmac/wx.checklistbox.png :alt: wxMAC :figclass: floatright **wxMAC** .. figure:: _static/images/widgets/fullsize/wxgtk/wx.checklistbox.png :alt: wxGTK :figclass: floatcenter **wxGTK** | |sub_classes| Known Subclasses ============================== :ref:`wx.RearrangeList` | |method_summary| Methods Summary ================================ ================================================================================ ================================================================================ :meth:`~wx.CheckListBox.__init__` Constructor, creating and showing a list box. :meth:`~wx.CheckListBox.Check` Checks the given item. :meth:`~wx.CheckListBox.Create` :meth:`~wx.CheckListBox.GetCheckedItems` GetCheckedItems() :meth:`~wx.CheckListBox.GetCheckedStrings` GetCheckedStrings() :meth:`~wx.CheckListBox.GetClassDefaultAttributes` :meth:`~wx.CheckListBox.GetSelections` Returns a list of the indices of the currently selected items. :meth:`~wx.CheckListBox.IsChecked` Returns ``True`` if the given item is checked, ``False`` otherwise. :meth:`~wx.CheckListBox.SetCheckedItems` SetCheckedItems(indexes) :meth:`~wx.CheckListBox.SetCheckedStrings` SetCheckedStrings(strings) ================================================================================ ================================================================================ | |property_summary| Properties Summary ===================================== ================================================================================ ================================================================================ :attr:`~wx.CheckListBox.Checked` See :meth:`~wx.CheckListBox.GetChecked` and :meth:`~wx.CheckListBox.SetChecked` :attr:`~wx.CheckListBox.CheckedItems` See :meth:`~wx.CheckListBox.GetCheckedItems` and :meth:`~wx.CheckListBox.SetCheckedItems` :attr:`~wx.CheckListBox.CheckedStrings` See :meth:`~wx.CheckListBox.GetCheckedStrings` and :meth:`~wx.CheckListBox.SetCheckedStrings` ================================================================================ ================================================================================ | |api| Class API =============== .. class:: wx.CheckListBox(ListBox) **Possible constructors**:: CheckListBox(parent, id=ID_ANY, pos=DefaultPosition, size=DefaultSize, choices=[], style=0, validator=DefaultValidator, name="listBox") CheckListBox() A CheckListBox is like a ListBox, but allows items to be checked or unchecked. .. method:: __init__(self, *args, **kw) |overload| Overloaded Implementations: :html:`

` **__init__** `(self, parent, id=ID_ANY, pos=DefaultPosition, size=DefaultSize, choices=[], style=0, validator=DefaultValidator, name="listBox")` Constructor, creating and showing a list box. :param `parent`: Parent window. Must not be ``None``. :type `parent`: wx.Window :param `id`: Window identifier. The value ``wx.ID_ANY`` indicates a default value. :type `id`: wx.WindowID :param `pos`: Window position. :type `pos`: wx.Point :param `size`: Window size. If DefaultSize is specified then the window is sized appropriately. :type `size`: wx.Size :param `choices`: An array of strings with which to initialise the control. :type `choices`: list of strings :param `style`: Window style. See :ref:`wx.CheckListBox`. :type `style`: long :param `validator`: Window validator. :type `validator`: wx.Validator :param `name`: Window name. :type `name`: string :html:`

` **__init__** `(self)` Default constructor. :html:`

` .. method:: Check(self, item, check=True) Checks the given item. Note that calling this method does not result in a ``wxEVT_CHECKLISTBOX`` event being emitted. :param `item`: Index of item to check. :type `item`: int :param `check`: ``True`` if the item is to be checked, ``False`` otherwise. :type `check`: bool .. method:: Create(self, parent, id=ID_ANY, pos=DefaultPosition, size=DefaultSize, choices=[], style=0, validator=DefaultValidator, name=ListBoxNameStr) :param `parent`: :type `parent`: wx.Window :param `id`: :type `id`: wx.WindowID :param `pos`: :type `pos`: wx.Point :param `size`: :type `size`: wx.Size :param `choices`: :type `choices`: list of strings :param `style`: :type `style`: long :param `validator`: :type `validator`: wx.Validator :param `name`: :type `name`: string :rtype: `bool` .. method:: GetCheckedItems(self) GetCheckedItems() Return a sequence of integers corresponding to the checked items in the control, based on :meth:`IsChecked`. .. method:: GetCheckedStrings(self) GetCheckedStrings() Return a tuple of strings corresponding to the checked items of the control, based on :meth:`GetChecked`. .. staticmethod:: GetClassDefaultAttributes(variant=WINDOW_VARIANT_NORMAL) :param `variant`: :type `variant`: wx.WindowVariant :rtype: :ref:`wx.VisualAttributes` .. method:: GetSelections(self) Returns a list of the indices of the currently selected items. :rtype: `list of integers` .. method:: IsChecked(self, item) Returns ``True`` if the given item is checked, ``False`` otherwise. :param `item`: Index of item whose check status is to be returned. :type `item`: int :rtype: `bool` .. method:: SetCheckedItems(self, indexes) SetCheckedItems(indexes) Sets the checked state of items if the index of the item is found in the indexes sequence. .. method:: SetCheckedStrings(self, strings) SetCheckedStrings(strings) Sets the checked state of items if the item's string is found in the strings sequence. .. attribute:: Checked See :meth:`~wx.CheckListBox.GetChecked` and :meth:`~wx.CheckListBox.SetChecked` .. attribute:: CheckedItems See :meth:`~wx.CheckListBox.GetCheckedItems` and :meth:`~wx.CheckListBox.SetCheckedItems` .. attribute:: CheckedStrings See :meth:`~wx.CheckListBox.GetCheckedStrings` and :meth:`~wx.CheckListBox.SetCheckedStrings`