]>
Commit | Line | Data |
---|---|---|
1 | # 11/15/2003 - Jeff Grimmett (grimmtooth@softhome.net) | |
2 | # | |
3 | # o Updated for wx namespace | |
4 | # | |
5 | # This file is used for the wx.HtmlWindow demo. | |
6 | # | |
7 | ||
8 | import sys | |
9 | ||
10 | import wx | |
11 | import wx.html as html | |
12 | ||
13 | #---------------------------------------------------------------------- | |
14 | ||
15 | class TestPanel(wx.Panel): | |
16 | def __init__(self, parent, id=-1, size=wx.DefaultSize, bgcolor=None): | |
17 | wx.Panel.__init__(self, parent, id, size=size) | |
18 | ||
19 | if bgcolor: | |
20 | self.SetBackgroundColour(bgcolor) | |
21 | ||
22 | wx.StaticText(self, -1, 'Name:', (10, 10)) | |
23 | wx.StaticText(self, -1, 'Email:', (10, 40)) | |
24 | ||
25 | self.name = wx.TextCtrl(self, -1, '', (50, 10), (100, -1)) | |
26 | self.email = wx.TextCtrl(self, -1, '', (50, 40), (100, -1)) | |
27 | ||
28 | wx.Button(self, -1, 'Okay', (50, 70)) | |
29 | self.Bind(wx.EVT_BUTTON, self.OnButton) | |
30 | ||
31 | ||
32 | def OnButton(self, event): | |
33 | name = self.name.GetValue() | |
34 | email = self.email.GetValue() | |
35 | dlg = wx.MessageDialog( | |
36 | self, 'You entered:\n %s\n %s' % (name, email), | |
37 | 'Results', style = wx.OK | wx.ICON_INFORMATION | |
38 | ) | |
39 | ||
40 | dlg.ShowModal() | |
41 | dlg.Destroy() | |
42 | ||
43 | ||
44 | ||
45 | #---------------------------------------------------------------------- | |
46 | ||
47 | class TestHtmlPanel(wx.Panel): | |
48 | def __init__(self, parent, id=-1, size=wx.DefaultSize): | |
49 | ||
50 | import About | |
51 | ||
52 | wx.Panel.__init__(self, parent, id, size=size) | |
53 | self.html = html.HtmlWindow(self, -1, (5,5), (400, 350)) | |
54 | py_version = sys.version.split()[0] | |
55 | self.html.SetPage(About.MyAboutBox.text % (wx.VERSION_STRING, py_version)) | |
56 | ir = self.html.GetInternalRepresentation() | |
57 | self.html.SetSize( (ir.GetWidth()+5, ir.GetHeight()+5) ) | |
58 | self.Fit() | |
59 | ||
60 | #---------------------------------------------------------------------- | |
61 | ||
62 | def runTest(frame, nb, log): | |
63 | win = TestHtmlPanel(frame) | |
64 | return win | |
65 | ||
66 | #---------------------------------------------------------------------- | |
67 | ||
68 | if __name__ == '__main__': | |
69 | import sys,os | |
70 | import run | |
71 | run.main(['', os.path.basename(sys.argv[0])]) | |
72 |