5 from wxPython
.wx
import *
6 from wxPython
.html
import *
8 #----------------------------------------------------------------------
11 class TestPanel(wxPanel
):
12 def __init__(self
, parent
, id=-1, size
=wxDefaultSize
, bgcolor
=None):
13 wxPanel
.__init
__(self
, parent
, id, size
=size
)
16 self
.SetBackgroundColour(bgcolor
)
18 wxStaticText(self
, -1, 'Name:', wxPoint(10, 10))
19 wxStaticText(self
, -1, 'Email:', wxPoint(10, 40))
21 self
.name
= wxTextCtrl(self
, -1, '', wxPoint(50, 10), wxSize(100, -1))
22 self
.email
= wxTextCtrl(self
, -1, '', wxPoint(50, 40), wxSize(100, -1))
24 wxButton(self
, 12121, 'Okay', wxPoint(50, 70))
25 EVT_BUTTON(self
, 12121, self
.OnButton
)
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
)
39 #----------------------------------------------------------------------
41 class TestHtmlPanel(wxPanel
):
42 def __init__(self
, parent
, id=-1, size
=wxDefaultSize
):
44 wxPanel
.__init
__(self
, parent
, id, size
=size
)
45 self
.html
= wxHtmlWindow(self
, -1, wxPoint(5,5), wxSize(400, 350))
46 py_version
= sys
.version
.split()[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) )
52 #----------------------------------------------------------------------