= How to create a check box (Phoenix) =
'''Keywords :''' Check box.

<<TableOfContents>>

--------
= Introduction : =
{{{wx.CheckBox}}} is a widget that has two states.

On and Off.

It is a box with a label.

The label can be set to the right or to the left of the box.

If the checkbox is checked, it is represented by a tick in a  box.

'''{{{wx.CheckBox styles :}}}'''

 * wx.ALIGN_RIGHT

||||<style="text-align:center;">'''{{{wx.CheckBox methods}}}''' ||
||<#d0d0d0>{{{bool GetValue()}}} ||<#d0d0d0>get the state of the checkbox ||
||{{{bool IsChecked()}}} ||determine the checkbox state ||
||<#d0d0d0>{{{SetValue(bool state)}}} ||<#d0d0d0>set the state of the checkbox ||


(info by '''Jan Bodnar / Zetcode''').

--------
= Demonstrating : =
__'''''Tested''' py3.x, wx4.x and Win10. ''__

Are you ready to use some samples ? ;)

Test, modify, correct, complete, improve and share your discoveries ! (!)

--------
== Sample one ==
{{attachment:img_sample_one.png}}

In our script we toggle the visibility of the title.

{{{#!python
# sample_one.py

"""

Author : Jan Bodnar
Website : zetcode.com

"""

import wx
import random

# class MyCheckBox

#---------------------------------------------------------------------------

class MyCheckBox(wx.Frame):
    def __init__(self, parent, id, title):
        wx.Frame.__init__(self, parent, id, title, size=(300, 170))

        self.SetIcon(wx.Icon('./icons/icon_wxWidgets.ico', wx.BITMAP_TYPE_ICO))

        #------------

        panel = wx.Panel(self, -1)

        self.cb = wx.CheckBox(panel, -1, 'Show Title', (10, 10))
        self.cb.SetValue(True)

        #------------

        self.Bind(wx.EVT_CHECKBOX, self.ShowTitle, self.cb)

        #------------

        self.Centre()

        #------------

        self.Show()

    #-----------------------------------------------------------------------

    def ShowTitle(self, event):
        if self.cb.GetValue():
            self.SetTitle('Checkbox.py')
        else: self.SetTitle('')

#---------------------------------------------------------------------------

app = wx.App(0)
MyCheckBox(None, -1, 'wx.CheckBox')
app.MainLoop()
}}}
--------
= Download source =
[[attachment:source.zip]]

--------
= Additional Information =
'''Link :'''

- - - - -

https://wiki.wxpython.org/TitleIndex

https://docs.wxpython.org/

--------
= Thanks to =
Jan Bodnar (sample_one.py coding), the wxPython community...

--------
= About this page =
Date(d/m/y)     Person (bot)    Comments :

15/12/20 - Ecco (Created page for wxPython Phoenix).

--------
= Comments =
- blah, blah, blah....