How to create a check box (Phoenix)
Keywords : Check box.
Contents
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
Toggle line numbers
1 # sample_one.py
2
3 """
4
5 Author : Jan Bodnar
6 Website : zetcode.com
7 Link : http://zetcode.com/wxpython/gdi/
8
9 """
10
11 import wx
12 import random
13
14 # class MyCheckBox
15
16 #---------------------------------------------------------------------------
17
18 class MyCheckBox(wx.Frame):
19 def __init__(self, parent, id, title):
20 wx.Frame.__init__(self, parent, id, title, size=(300, 170))
21
22 self.SetIcon(wx.Icon('./icons/icon_wxWidgets.ico', wx.BITMAP_TYPE_ICO))
23
24 #------------
25
26 panel = wx.Panel(self, -1)
27
28 self.cb = wx.CheckBox(panel, -1, 'Show Title', (10, 10))
29 self.cb.SetValue(True)
30
31 #------------
32
33 self.Bind(wx.EVT_CHECKBOX, self.ShowTitle, self.cb)
34
35 #------------
36
37 self.Centre()
38
39 #------------
40
41 self.Show()
42
43 #---------------------------------------------------------------------------
44
45 def ShowTitle(self, event):
46 if self.cb.GetValue():
47 self.SetTitle('Checkbox.py')
48 else: self.SetTitle('')
49
50 #---------------------------------------------------------------------------
51
52 app = wx.App(0)
53 MyCheckBox(None, -1, 'wx.CheckBox')
54 app.MainLoop()
Download source
Additional Information
Link :
- - - - -
https://wiki.wxpython.org/TitleIndex
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....