]>
Commit | Line | Data |
---|---|---|
8fa876ca RD |
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 | # | |
e166644c | 7 | |
8fa876ca | 8 | import sys |
e166644c | 9 | |
8fa876ca RD |
10 | import wx |
11 | import wx.html as html | |
e166644c RD |
12 | |
13 | #---------------------------------------------------------------------- | |
14 | ||
8fa876ca RD |
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) | |
e166644c RD |
18 | |
19 | if bgcolor: | |
20 | self.SetBackgroundColour(bgcolor) | |
21 | ||
8fa876ca RD |
22 | wx.StaticText(self, -1, 'Name:', (10, 10)) |
23 | wx.StaticText(self, -1, 'Email:', (10, 40)) | |
e166644c | 24 | |
8fa876ca RD |
25 | self.name = wx.TextCtrl(self, -1, '', (50, 10), (100, -1)) |
26 | self.email = wx.TextCtrl(self, -1, '', (50, 40), (100, -1)) | |
e166644c | 27 | |
8fa876ca RD |
28 | wx.Button(self, -1, 'Okay', (50, 70)) |
29 | self.Bind(wx.EVT_BUTTON, self.OnButton) | |
e166644c RD |
30 | |
31 | ||
32 | def OnButton(self, event): | |
33 | name = self.name.GetValue() | |
34 | email = self.email.GetValue() | |
8fa876ca RD |
35 | dlg = wx.MessageDialog( |
36 | self, 'You entered:\n %s\n %s' % (name, email), | |
37 | 'Results', style = wx.OK | wx.ICON_INFORMATION | |
38 | ) | |
39 | ||
e166644c RD |
40 | dlg.ShowModal() |
41 | dlg.Destroy() | |
42 | ||
43 | ||
44 | ||
45 | #---------------------------------------------------------------------- | |
46 | ||
8fa876ca RD |
47 | class TestHtmlPanel(wx.Panel): |
48 | def __init__(self, parent, id=-1, size=wx.DefaultSize): | |
49 | ||
e166644c | 50 | import About |
8fa876ca RD |
51 | |
52 | wx.Panel.__init__(self, parent, id, size=size) | |
53 | self.html = html.HtmlWindow(self, -1, (5,5), (400, 350)) | |
1e4a197e | 54 | py_version = sys.version.split()[0] |
8fa876ca | 55 | self.html.SetPage(About.MyAboutBox.text % (wx.VERSION_STRING, py_version)) |
c368d904 RD |
56 | ir = self.html.GetInternalRepresentation() |
57 | self.html.SetSize( (ir.GetWidth()+5, ir.GetHeight()+5) ) | |
e166644c RD |
58 | self.Fit() |
59 | ||
60 | #---------------------------------------------------------------------- | |
61 | ||
8fa876ca RD |
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])]) | |
e166644c | 72 |