]>
git.saurik.com Git - wxWidgets.git/blob - wxPython/demo/widgetTest.py
1 # 11/15/2003 - Jeff Grimmett (grimmtooth@softhome.net)
3 # o Updated for wx namespace
5 # This file is used for the wx.HtmlWindow demo.
11 import wx
.html
as html
13 #----------------------------------------------------------------------
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
)
20 self
.SetBackgroundColour(bgcolor
)
22 wx
.StaticText(self
, -1, 'Name:', (10, 10))
23 wx
.StaticText(self
, -1, 'Email:', (10, 40))
25 self
.name
= wx
.TextCtrl(self
, -1, '', (50, 10), (100, -1))
26 self
.email
= wx
.TextCtrl(self
, -1, '', (50, 40), (100, -1))
28 wx
.Button(self
, -1, 'Okay', (50, 70))
29 self
.Bind(wx
.EVT_BUTTON
, self
.OnButton
)
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
45 #----------------------------------------------------------------------
47 class TestHtmlPanel(wx
.Panel
):
48 def __init__(self
, parent
, id=-1, size
=wx
.DefaultSize
):
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) )
60 #----------------------------------------------------------------------
62 def runTest(frame
, nb
, log
):
63 win
= TestHtmlPanel(frame
)
66 #----------------------------------------------------------------------
68 if __name__
== '__main__':
71 run
.main(['', os
.path
.basename(sys
.argv
[0])])