]> git.saurik.com Git - wxWidgets.git/blame_incremental - wxPython/demo/XML_Resource.py
nicer version compilation fix for wxUSE_WCHAR_T=0 (why should we duplicate definition...
[wxWidgets.git] / wxPython / demo / XML_Resource.py
... / ...
CommitLineData
1
2from wxPython.wx import *
3from wxPython.xrc import *
4
5#----------------------------------------------------------------------
6
7RESFILE = "data/resource_wdr.xrc"
8
9class TestPanel(wxPanel):
10 def __init__(self, parent, log):
11 wxPanel.__init__(self, parent, -1)
12 self.log = log
13
14 # make the components
15 label = wxStaticText(self, -1, "The lower panel was built from this XML:")
16 label.SetFont(wxFont(12, wxSWISS, wxNORMAL, wxBOLD))
17
18 text = wxTextCtrl(self, -1, open(RESFILE).read(),
19 style=wxTE_READONLY|wxTE_MULTILINE)
20 text.SetInsertionPoint(0)
21
22 line = wxStaticLine(self, -1)
23
24 res = wxXmlResource(RESFILE)
25 panel = res.LoadPanel(self, "MyPanel")
26
27 # and do the layout
28 sizer = wxBoxSizer(wxVERTICAL)
29 sizer.Add(label, 0, wxEXPAND|wxTOP|wxLEFT, 5)
30 sizer.Add(text, 1, wxEXPAND|wxALL, 5)
31 sizer.Add(line, 0, wxEXPAND)
32 sizer.Add(panel, 1, wxEXPAND|wxALL, 5)
33
34 self.SetSizer(sizer)
35 self.SetAutoLayout(true)
36
37
38#----------------------------------------------------------------------
39
40def runTest(frame, nb, log):
41 win = TestPanel(nb, log)
42 return win
43
44#----------------------------------------------------------------------
45
46
47
48overview = """
49"""