.. 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.png" 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="wx.CheckListBox" alt="" coords="130,392,263,421"/> <area shape="rect" id="node2" href="wx.ListBox.html" title="wx.ListBox" alt="" coords="150,315,243,344"/> <area shape="rect" id="node3" href="wx.Control.html" title="wx.Control" alt="" coords="81,237,173,267"/> <area shape="rect" id="node4" href="wx.ItemContainer.html" title="wx.ItemContainer" alt="" coords="207,237,346,267"/> <area shape="rect" id="node5" href="wx.Window.html" title="wx.Window" alt="" coords="60,160,157,189"/> <area shape="rect" id="node6" href="wx.EvtHandler.html" title="wx.EvtHandler" alt="" coords="50,83,167,112"/> <area shape="rect" id="node7" href="wx.Object.html" title="wx.Object" alt="" coords="5,5,92,35"/> <area shape="rect" id="node8" href="wx.Trackable.html" title="wx.Trackable" alt="" coords="117,5,223,35"/> <area shape="rect" id="node9" href="wx.ItemContainerImmutable.html" title="wx.ItemContainerImmutable" alt="" coords="181,160,391,189"/> </map> 
   </p>
   </div>

|


|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.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:`<hr class="overloadsep" /><br />`

      
      **__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:`<hr class="overloadsep" /><br />`

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






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

