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

.. module:: wx.lib.checkbox

.. currentmodule:: wx.lib.checkbox

.. highlight:: python



.. _wx.lib.checkbox:

==========================================================================================================================================
|phoenix_title|  **wx.lib.checkbox**
==========================================================================================================================================

This module implements various forms of generic checkboxes, meaning that
they are not built on native controls but are self-drawn.


Description
===========

This module implements various forms of generic checkboxes, meaning that
they are not built on native controls but are self-drawn.
They should act like normal checkboxes but you are able to better control how they look, etc...


Usage
=====

Sample usage::

    app = wx.App(redirect=False)
    class MyFrame(wx.Frame, DefineNativeCheckBoxBitmapsMixin):
        def __init__(self, parent, id=wx.ID_ANY, title=wx.EmptyString,
                     pos=wx.DefaultPosition, size=wx.DefaultSize,
                     style=wx.DEFAULT_FRAME_STYLE, name='frame'):
            wx.Frame.__init__(self, parent, id, title, pos, size, style, name)
            ## self.DefineNativeCheckBoxBitmaps()
            ## self.checkbox_bitmaps = self.GetNativeCheckBoxBitmaps()
            cb1 = GenCheckBox(self, label="PurePython Checkbox1", pos=(10, 10))
            cb2 = GenCheckBox(self, label="PurePython Checkbox2", pos=(10, 50))
            cb1.Bind(wx.EVT_CHECKBOX, self.OnCheckBox)
            cb2.Bind(wx.EVT_CHECKBOX, self.OnCheckBox)
            cb2.SetForegroundColour(wx.GREEN)
            cb2.SetBackgroundColour(wx.BLACK)
            sizer = wx.BoxSizer()
            sizer.Add(cb1, 0, wx.ALL, 5)
            sizer.Add(cb2, 0, wx.ALL, 5)
            self.SetSizer(sizer)

        def OnCheckBox(self, event):
            evtObj = event.GetEventObject()
            print(evtObj.GetLabel(), evtObj.IsChecked())

    frame = MyFrame(None, wx.ID_ANY, "Test Pure-Py Checkbox")
    frame.Show()
    app.MainLoop()


|class_summary| Classes Summary
===============================

================================================================================ ================================================================================
:ref:`~wx.lib.checkbox.DefineNativeCheckBoxBitmapsMixin`                         Inherit this mixin in your :class:`wx.Window` based subclass to easily
:ref:`~wx.lib.checkbox.GenCheckBox`                                              A generic class that replicates some of the functionalities of :class:`wx.Checkbox`,
================================================================================ ================================================================================


|


.. toctree::
   :maxdepth: 1
   :hidden:

   wx.lib.checkbox.DefineNativeCheckBoxBitmapsMixin
   wx.lib.checkbox.GenCheckBox



