.. 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

   <div id="toggleBlock" onclick="return toggleVisibility(this)" class="closed" style="cursor:pointer;">
   <img id="toggleBlock-trigger" src="_static/images/closed.png"/>
   Inheritance diagram for class <strong>CheckListBox</strong>:
   </div>
   <div id="toggleBlock-summary" style="display:block;"></div>
   <div id="toggleBlock-content" style="display:none;">
   <p class="graphviz">
   <center><img src="_static/images/inheritance/wx.CheckListBox_inheritance.svg" alt="Inheritance diagram of CheckListBox" usemap="#dummy" class="inheritance"/></center>
   <script type="text/javascript">toggleVisibilityOnLoad(document.getElementById('toggleBlock'))</script>
   <map id="dummy" name="dummy"> <area shape="rect" id="node1" href="wx.CheckListBox.html" title="A wx.CheckListBox  is like a wx.ListBox, but allows items to be checked or unchecked." alt="" coords="142,389,293,418"/> <area shape="rect" id="node2" href="wx.ListBox.html" title="A listbox is used to select one or more of a list of strings." alt="" coords="164,313,270,341"/> <area shape="rect" id="node3" href="wx.Control.html" title="This is the base class for a control or 'widget'." alt="" coords="89,236,194,265"/> <area shape="rect" id="node4" href="wx.ItemContainer.html" title="This class is an abstract base class for some wxWidgets controls which contain several items such as wx.ListBox, wx.CheckListBox, wx.ComboBox  or wx.Choice." alt="" coords="228,236,380,265"/> <area shape="rect" id="node5" href="wx.Window.html" title="wx.Window  is the base class for all windows and represents any visible object on screen." alt="" coords="66,159,177,188"/> <area shape="rect" id="node6" href="wx.EvtHandler.html" title="A class that can handle events from the windowing system." alt="" coords="55,82,188,111"/> <area shape="rect" id="node7" href="wx.Object.html" title="This is the root class of many of the wxWidgets classes." alt="" coords="5,5,104,34"/> <area shape="rect" id="node8" href="wx.Trackable.html" title="Add-on base class for a trackable object." alt="" coords="128,5,251,34"/> <area shape="rect" id="node9" href="wx.ItemContainerImmutable.html" title="wx.ItemContainer  defines an interface which is implemented by all controls which have string subitems each of which may be selected." alt="" coords="201,159,428,188"/> </map> 
   </p>
   </div>

|


|appearance| Control Appearance
===============================

|

.. container:: control-appearance-figures

   .. figure:: _static/images/widgets/fullsize/wxmsw/wx.checklistbox.png
      :alt: wxMSW
      :figclass: appearance-figure

      **wxMSW**


   .. figure:: _static/images/widgets/fullsize/wxmac/wx.checklistbox.png
      :alt: wxMAC
      :figclass: appearance-figure

      **wxMAC**


   .. figure:: _static/images/widgets/fullsize/wxgtk/wx.checklistbox.png
      :alt: wxGTK
      :figclass: appearance-figure

      **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 : Window, id: int=ID_ANY, pos:
                    Point=DefaultPosition, size: Size=DefaultSize, choices: List[str]=[],
                    style: int=0, validator: Validator=DefaultValidator, name:
                    str="listBox") -> None
       
       CheckListBox() -> None
       
   
   A CheckListBox is like a ListBox, but allows items to be checked
   or unchecked.



   .. method:: __init__(self, *args, **kw)



      |overload| **Overloaded Implementations:**

      :html:`<hr class="overloadsep" /><br />`

      
      **__init__** `(self, parent : Window, id: int=ID_ANY, pos: Point=DefaultPosition, size: Size=DefaultSize, choices: List[str]=[], style: int=0, validator: Validator=DefaultValidator, name: str="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
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      :rtype: `None`     
      
      
      
      
      
      
      
      :html:`<hr class="overloadsep" /><br />`

      
      **__init__** `(self)`
      
      Default constructor. 
                       
      
      :rtype: `None`     
      
      
      
      
      
      
      
      :html:`<hr class="overloadsep" /><br />`






   .. method:: Check(self, item : int, check: bool=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








      :rtype: `None`     




                  





   .. method:: Create(self, parent : Window, id: int=ID_ANY, pos: Point=DefaultPosition, size: Size=DefaultSize, choices: List[str]=[], style: int=0, validator: Validator=DefaultValidator, name: str=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: WindowVariant=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[int]`     








   .. method:: IsChecked(self, item : int)

      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`