]>
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, wxPoint(80, 50), wxSize(80, 120),
20 EVT_LISTBOX(self
, 60, self
.EvtListBox
)
21 EVT_LISTBOX_DCLICK(self
, 60, self
.EvtListBoxDClick
)
24 EVT_RIGHT_UP(self
, self
.OnDoPopup
)
27 def EvtListBox(self
, event
):
28 self
.log
.WriteText('EvtListBox: %s\n' % event
.GetString())
30 def EvtListBoxDClick(self
, event
):
31 self
.log
.WriteText('EvtListBoxDClick:\n')
33 def OnDoPopup(self
, evt
):
35 # Make this first item bold
36 item
= wxMenuItem(menu
, wxNewId(), "If supported, this is &bold")
37 df
= wxSystemSettings_GetSystemFont(wxSYS_DEFAULT_GUI_FONT
)
38 nf
= wxFont(df
.GetPointSize(), df
.GetFamily(), df
.GetStyle(), wxBOLD
,
39 false
, df
.GetFaceName())
43 menu
.AppendItem(wxMenuItem(menu
, wxNewId(), "Normal Item &1"))
44 menu
.AppendItem(wxMenuItem(menu
, wxNewId(), "Normal Item &2"))
45 menu
.AppendItem(wxMenuItem(menu
, wxNewId(), "Normal Item &3"))
46 menu
.AppendItem(wxMenuItem(menu
, wxNewId(), "Normal Item &4"))
48 self
.PopupMenu(menu
, evt
.GetPosition())
53 #----------------------------------------------------------------------
55 def runTest(frame
, nb
, log
):
56 win
= TestPanel(nb
, log
)
59 #----------------------------------------------------------------------