]>
git.saurik.com Git - wxWidgets.git/blob - wxPython/demo/widgetTest.py
2 # This file is used for the wx.HtmlWindow demo.
10 #----------------------------------------------------------------------
12 class TestPanel(wx
.Panel
):
13 def __init__(self
, parent
, id=-1, size
=wx
.DefaultSize
, bgcolor
=None):
14 wx
.Panel
.__init
__(self
, parent
, id, size
=size
)
17 self
.SetBackgroundColour(bgcolor
)
19 wx
.StaticText(self
, -1, 'Name:', (10, 10))
20 wx
.StaticText(self
, -1, 'Email:', (10, 40))
22 self
.name
= wx
.TextCtrl(self
, -1, '', (50, 10), (100, -1))
23 self
.email
= wx
.TextCtrl(self
, -1, '', (50, 40), (100, -1))
25 wx
.Button(self
, -1, 'Okay', (50, 70))
26 self
.Bind(wx
.EVT_BUTTON
, self
.OnButton
)
29 def OnButton(self
, event
):
30 name
= self
.name
.GetValue()
31 email
= self
.email
.GetValue()
32 dlg
= wx
.MessageDialog(
33 self
, 'You entered:\n %s\n %s' % (name
, email
),
34 'Results', style
= wx
.OK | wx
.ICON_INFORMATION
42 #----------------------------------------------------------------------
44 class TestHtmlPanel(wx
.Panel
):
45 def __init__(self
, parent
, id=-1, size
=wx
.DefaultSize
):
49 wx
.Panel
.__init
__(self
, parent
, id, size
=size
)
50 self
.html
= html
.HtmlWindow(self
, -1, (5,5), (400, 350))
51 py_version
= sys
.version
.split()[0]
52 self
.html
.SetPage(About
.MyAboutBox
.text
% (wx
.VERSION_STRING
, py_version
))
53 ir
= self
.html
.GetInternalRepresentation()
54 self
.html
.SetSize( (ir
.GetWidth()+5, ir
.GetHeight()+5) )
57 #----------------------------------------------------------------------
59 def runTest(frame
, nb
, log
):
60 win
= TestHtmlPanel(frame
)
63 #----------------------------------------------------------------------
65 if __name__
== '__main__':
68 run
.main(['', os
.path
.basename(sys
.argv
[0])])