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