]> git.saurik.com Git - wxWidgets.git/blame_incremental - wxPython/tests/spies2.py
minor additions to wxCmdLineParser tests
[wxWidgets.git] / wxPython / tests / spies2.py
... / ...
CommitLineData
1from wxPython.wx import *
2
3#---------------------------------------------------------------------------
4
5class TestComboBox(wxDialog):
6 def __init__(self, parent):
7
8 wxDialog.__init__(self, parent, -1, "This is a test",
9 wxDefaultPosition, wxSize(550, 250))
10 self.s = ['aaaaaaaaaaaaaa',
11 'bbbbbbb',
12 'cccccccccccccccccccccccccccccccccccc',
13 'ddddddddddd',
14 'eeeeeeeeeee',
15 'ffffffff',
16 'gggggggggggggggggggggggg',
17 'hhhhhhhhhhhhhhhhhh',
18 'iiiiiiiiii']
19
20
21 wxStaticText(self, -1, "This example uses the wxListBox control.",
22 wxPoint(45, 10))
23 xwaarde = 35*12
24 wxStaticText(self, -1, "Select one:", wxPoint(15, 50), wxSize(65, -1))
25
26 dv = self.s[4]
27 self.lb= wxComboBox(self, 50, dv, wxPoint(80, 50), wxSize(xwaarde, -1),
28 self.s, wxCB_DROPDOWN)
29
30 wxButton(self, wxID_OK, "Okay", wxPoint(10,90)).SetDefault()
31 wxButton(self, wxID_CANCEL, "Cancel", wxPoint(60, 90))
32
33
34 def GetSelection(self,leer):
35
36 val1 = self.lb.GetStringSelection()
37 #leer.commit()
38 return val1
39
40
41
42class MyApp(wxApp):
43 def OnInit(self):
44
45 frame = wxFrame(NULL, -1, "")
46 wxButton(frame, 101, "test it", wxDefaultPosition, wxSize(50, 25))
47 EVT_BUTTON(frame, 101, self.OnClick)
48 frame.Fit()
49 frame.Show(true)
50
51 self.SetTopWindow(frame)
52 return true
53
54 def OnClick(self, event):
55
56 dlg = TestComboBox(NULL)
57
58 if dlg.ShowModal() == wxID_OK:
59 values = dlg.GetSelection(NULL)
60 print "Your values are: %s" % str(values)
61 else:
62 print "You canceled!"
63
64 dlg.Destroy()
65
66app = MyApp(0)
67app.MainLoop()
68
69