]> git.saurik.com Git - wxWidgets.git/blob - utils/wxPython/demo/widgetTest.py
Added a demo showing how to use wxPostEvent
[wxWidgets.git] / utils / wxPython / demo / widgetTest.py
1
2
3 from wxPython.wx import *
4 from wxPython.html import *
5
6 #----------------------------------------------------------------------
7
8
9 class TestPanel(wxPanel):
10 def __init__(self, parent, id=-1, size=wxDefaultSize, bgcolor=None):
11 wxPanel.__init__(self, parent, id, size=size)
12
13 if bgcolor:
14 self.SetBackgroundColour(bgcolor)
15
16 wxStaticText(self, -1, 'Name:', wxPoint(10, 10))
17 wxStaticText(self, -1, 'Email:', wxPoint(10, 40))
18
19 self.name = wxTextCtrl(self, -1, '', wxPoint(50, 10), wxSize(100, -1))
20 self.email = wxTextCtrl(self, -1, '', wxPoint(50, 40), wxSize(100, -1))
21
22 wxButton(self, 12121, 'Okay', wxPoint(50, 70))
23 EVT_BUTTON(self, 12121, self.OnButton)
24
25
26 def OnButton(self, event):
27 name = self.name.GetValue()
28 email = self.email.GetValue()
29 dlg = wxMessageDialog(self,
30 'You entered:\n %s\n %s' % (name, email),
31 'Results', style = wxOK | wxICON_INFORMATION)
32 dlg.ShowModal()
33 dlg.Destroy()
34
35
36
37 #----------------------------------------------------------------------
38
39 class TestHtmlPanel(wxPanel):
40 def __init__(self, parent, id=-1, size=wxDefaultSize):
41 import About
42 wxPanel.__init__(self, parent, id, size=size)
43 self.html = wxHtmlWindow(self, -1, wxPoint(5,5), wxSize(400, 350))
44 self.html.SetPage(About.MyAboutBox.text % wx.__version__)
45 self.Fit()
46
47 #----------------------------------------------------------------------
48
49