]> git.saurik.com Git - wxWidgets.git/blame - wxPython/tests/getvalues.py
added visual c++ makefiles
[wxWidgets.git] / wxPython / tests / getvalues.py
CommitLineData
8bf5d46e
RD
1from wxPython.wx import *
2
3class MyDlg(wxDialog):
4 def __init__(self, parent):
5 wxDialog.__init__(self, parent, -1, "This is a test",
6 wxDefaultPosition, wxSize(150, 150))
7
8 self.text1 = wxTextCtrl(self, -1, "", wxPoint(10, 10), wxSize(120, -1))
9 self.text2 = wxTextCtrl(self, -1, "", wxPoint(10, 40), wxSize(120, -1))
10
11 wxButton(self, wxID_OK, "Okay", wxPoint(10,70)).SetDefault()
12 wxButton(self, wxID_CANCEL, "Cancel", wxPoint(60, 70))
13
14
15 def GetValues(self):
16 val1 = self.text1.GetValue()
17 val2 = self.text2.GetValue()
18 return (val1, val2)
19
20
21
22
23class MyApp(wxApp):
24 def OnInit(self):
25
26 frame = wxFrame(NULL, -1, "")
27 wxButton(frame, 101, "test it", wxDefaultPosition, wxSize(50, 25))
28 EVT_BUTTON(frame, 101, self.OnClick)
29 frame.Fit()
30 frame.Show(true)
31
32 self.SetTopWindow(frame)
33 return true
34
35 def OnClick(self, event):
36 dlg = MyDlg(NULL)
37 if dlg.ShowModal() == wxID_OK:
38 values = dlg.GetValues()
39 print "Your values are: %s" % str(values)
40 else:
41 print "You canceled!"
42
43 dlg.Destroy()
44
45
46
47app = MyApp(0)
48app.MainLoop()