]> git.saurik.com Git - wxWidgets.git/blame - wxPython/demo/wxCheckListBox.py
fixed the width of the (week day as number) field, should be 1, not 2
[wxWidgets.git] / wxPython / demo / wxCheckListBox.py
CommitLineData
cf694132
RD
1
2from wxPython.wx import *
3
4#----------------------------------------------------------------------
5
6class TestPanel(wxPanel):
7 def __init__(self, parent, log):
8 wxPanel.__init__(self, parent, -1)
9 self.log = log
10
11 sampleList = ['zero', 'one', 'two', 'three', 'four', 'five',
12 'six', 'seven', 'eight', 'nine', 'ten', 'eleven',
13 'twelve', 'thirteen', 'fourteen']
14
15 wxStaticText(self, -1, "This example uses the wxCheckListBox control.",
be43cc44 16 (45, 15))
cf694132 17
be43cc44 18 lb = wxCheckListBox(self, 60, (80, 50), (80, 120),
cf694132
RD
19 sampleList)
20 EVT_LISTBOX(self, 60, self.EvtListBox)
21 EVT_LISTBOX_DCLICK(self, 60, self.EvtListBoxDClick)
22 lb.SetSelection(0)
be43cc44
RD
23 self.lb = lb
24
25 btn = wxButton(self, -1, "Test SetString", (180, 50))
26 EVT_BUTTON(self, btn.GetId(), self.OnTestButton)
cf694132 27
25832b3f
RD
28 EVT_RIGHT_UP(self, self.OnDoPopup)
29
cf694132
RD
30
31 def EvtListBox(self, event):
32 self.log.WriteText('EvtListBox: %s\n' % event.GetString())
33
34 def EvtListBoxDClick(self, event):
35 self.log.WriteText('EvtListBoxDClick:\n')
36
be43cc44
RD
37 def OnTestButton(self, evt):
38 self.lb.SetString(4, "FUBAR")
39
40
25832b3f
RD
41 def OnDoPopup(self, evt):
42 menu = wxMenu()
43 # Make this first item bold
611dc22c 44 item = wxMenuItem(menu, wxNewId(), "If supported, this is bold")
25832b3f
RD
45 df = wxSystemSettings_GetSystemFont(wxSYS_DEFAULT_GUI_FONT)
46 nf = wxFont(df.GetPointSize(), df.GetFamily(), df.GetStyle(), wxBOLD,
47 false, df.GetFaceName())
48 item.SetFont(nf)
49 menu.AppendItem(item)
50
1fb264fd
RD
51 menu.AppendItem(wxMenuItem(menu, wxNewId(), "Normal Item &1"))
52 menu.AppendItem(wxMenuItem(menu, wxNewId(), "Normal Item &2"))
53 menu.AppendItem(wxMenuItem(menu, wxNewId(), "Normal Item &3"))
54 menu.AppendItem(wxMenuItem(menu, wxNewId(), "Normal Item &4"))
25832b3f
RD
55
56 self.PopupMenu(menu, evt.GetPosition())
57 menu.Destroy()
58 evt.Skip()
cf694132
RD
59
60
61#----------------------------------------------------------------------
62
63def runTest(frame, nb, log):
64 win = TestPanel(nb, log)
65 return win
66
67#----------------------------------------------------------------------
68
69
70
71
72
73
74
75
76
77
78overview = """\
79"""
80
81