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