1999-04-29 23:29:54 -04:00
|
|
|
|
|
|
|
from wxPython.wx import *
|
|
|
|
|
|
|
|
#----------------------------------------------------------------------
|
|
|
|
|
|
|
|
class TestPanel(wxPanel):
|
|
|
|
def __init__(self, parent, log):
|
|
|
|
wxPanel.__init__(self, parent, -1)
|
|
|
|
self.log = log
|
|
|
|
|
|
|
|
sampleList = ['zero', 'one', 'two', 'three', 'four', 'five',
|
|
|
|
'six', 'seven', 'eight', 'nine', 'ten', 'eleven',
|
|
|
|
'twelve', 'thirteen', 'fourteen']
|
|
|
|
|
|
|
|
wxStaticText(self, -1, "This example uses the wxCheckListBox control.",
|
2002-02-12 16:28:41 -05:00
|
|
|
(45, 15))
|
1999-04-29 23:29:54 -04:00
|
|
|
|
2002-02-12 16:28:41 -05:00
|
|
|
lb = wxCheckListBox(self, 60, (80, 50), (80, 120),
|
1999-04-29 23:29:54 -04:00
|
|
|
sampleList)
|
|
|
|
EVT_LISTBOX(self, 60, self.EvtListBox)
|
|
|
|
EVT_LISTBOX_DCLICK(self, 60, self.EvtListBoxDClick)
|
|
|
|
lb.SetSelection(0)
|
2002-02-12 16:28:41 -05:00
|
|
|
self.lb = lb
|
|
|
|
|
2003-03-25 01:35:27 -05:00
|
|
|
pos = lb.GetPosition().x + lb.GetSize().width + 25
|
|
|
|
btn = wxButton(self, -1, "Test SetString", (pos, 50))
|
2002-02-12 16:28:41 -05:00
|
|
|
EVT_BUTTON(self, btn.GetId(), self.OnTestButton)
|
1999-04-29 23:29:54 -04:00
|
|
|
|
2001-05-22 01:59:09 -04:00
|
|
|
EVT_RIGHT_UP(self, self.OnDoPopup)
|
|
|
|
|
1999-04-29 23:29:54 -04:00
|
|
|
|
|
|
|
def EvtListBox(self, event):
|
|
|
|
self.log.WriteText('EvtListBox: %s\n' % event.GetString())
|
|
|
|
|
|
|
|
def EvtListBoxDClick(self, event):
|
|
|
|
self.log.WriteText('EvtListBoxDClick:\n')
|
|
|
|
|
2002-02-12 16:28:41 -05:00
|
|
|
def OnTestButton(self, evt):
|
|
|
|
self.lb.SetString(4, "FUBAR")
|
|
|
|
|
|
|
|
|
2001-05-22 01:59:09 -04:00
|
|
|
def OnDoPopup(self, evt):
|
|
|
|
menu = wxMenu()
|
|
|
|
# Make this first item bold
|
2001-11-30 16:16:36 -05:00
|
|
|
item = wxMenuItem(menu, wxNewId(), "If supported, this is bold")
|
2001-05-22 01:59:09 -04:00
|
|
|
df = wxSystemSettings_GetSystemFont(wxSYS_DEFAULT_GUI_FONT)
|
|
|
|
nf = wxFont(df.GetPointSize(), df.GetFamily(), df.GetStyle(), wxBOLD,
|
2003-03-25 01:35:27 -05:00
|
|
|
False, df.GetFaceName())
|
2001-05-22 01:59:09 -04:00
|
|
|
item.SetFont(nf)
|
|
|
|
menu.AppendItem(item)
|
|
|
|
|
2001-05-22 12:02:58 -04:00
|
|
|
menu.AppendItem(wxMenuItem(menu, wxNewId(), "Normal Item &1"))
|
|
|
|
menu.AppendItem(wxMenuItem(menu, wxNewId(), "Normal Item &2"))
|
|
|
|
menu.AppendItem(wxMenuItem(menu, wxNewId(), "Normal Item &3"))
|
|
|
|
menu.AppendItem(wxMenuItem(menu, wxNewId(), "Normal Item &4"))
|
2001-05-22 01:59:09 -04:00
|
|
|
|
|
|
|
self.PopupMenu(menu, evt.GetPosition())
|
|
|
|
menu.Destroy()
|
|
|
|
evt.Skip()
|
1999-04-29 23:29:54 -04:00
|
|
|
|
|
|
|
|
|
|
|
#----------------------------------------------------------------------
|
|
|
|
|
|
|
|
def runTest(frame, nb, log):
|
|
|
|
win = TestPanel(nb, log)
|
|
|
|
return win
|
|
|
|
|
|
|
|
#----------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2003-07-02 19:13:10 -04:00
|
|
|
overview = """\
|
|
|
|
"""
|
1999-04-29 23:29:54 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2003-07-02 19:13:10 -04:00
|
|
|
if __name__ == '__main__':
|
|
|
|
import sys,os
|
|
|
|
import run
|
|
|
|
run.main(['', os.path.basename(sys.argv[0])])
|
1999-04-29 23:29:54 -04:00
|
|
|
|