]>
git.saurik.com Git - wxWidgets.git/blob - wxPython/demo/wxCheckListBox.py
2 from wxPython
.wx
import *
4 #----------------------------------------------------------------------
6 class TestPanel(wxPanel
):
7 def __init__(self
, parent
, log
):
8 wxPanel
.__init
__(self
, parent
, -1)
11 sampleList
= ['zero', 'one', 'two', 'three', 'four', 'five',
12 'six', 'seven', 'eight', 'nine', 'ten', 'eleven',
13 'twelve', 'thirteen', 'fourteen']
15 wxStaticText(self
, -1, "This example uses the wxCheckListBox control.",
18 lb
= wxCheckListBox(self
, 60, (80, 50), (80, 120),
20 EVT_LISTBOX(self
, 60, self
.EvtListBox
)
21 EVT_LISTBOX_DCLICK(self
, 60, self
.EvtListBoxDClick
)
25 btn
= wxButton(self
, -1, "Test SetString", (180, 50))
26 EVT_BUTTON(self
, btn
.GetId(), self
.OnTestButton
)
28 EVT_RIGHT_UP(self
, self
.OnDoPopup
)
31 def EvtListBox(self
, event
):
32 self
.log
.WriteText('EvtListBox: %s\n' % event
.GetString())
34 def EvtListBoxDClick(self
, event
):
35 self
.log
.WriteText('EvtListBoxDClick:\n')
37 def OnTestButton(self
, evt
):
38 self
.lb
.SetString(4, "FUBAR")
41 def OnDoPopup(self
, evt
):
43 # Make this first item bold
44 item
= wxMenuItem(menu
, wxNewId(), "If supported, this is bold")
45 df
= wxSystemSettings_GetSystemFont(wxSYS_DEFAULT_GUI_FONT
)
46 nf
= wxFont(df
.GetPointSize(), df
.GetFamily(), df
.GetStyle(), wxBOLD
,
47 false
, df
.GetFaceName())
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"))
56 self
.PopupMenu(menu
, evt
.GetPosition())
61 #----------------------------------------------------------------------
63 def runTest(frame
, nb
, log
):
64 win
= TestPanel(nb
, log
)
67 #----------------------------------------------------------------------