]> git.saurik.com Git - wxWidgets.git/blob - wxPython/demo/Layoutf.py
correction for Mac OS X compilation
[wxWidgets.git] / wxPython / demo / Layoutf.py
1
2 from wxPython.wx import *
3 from wxPython.lib.layoutf import Layoutf
4
5 #---------------------------------------------------------------------------
6
7 class TestLayoutf(wxPanel):
8 def __init__(self, parent):
9 wxPanel.__init__(self, parent, -1)
10
11 self.SetAutoLayout(true)
12 EVT_BUTTON(self, 100, self.OnButton)
13
14 self.panelA = wxWindow(self, -1, wxPyDefaultPosition, wxPyDefaultSize, wxSIMPLE_BORDER)
15 self.panelA.SetBackgroundColour(wxBLUE)
16 self.panelA.SetConstraints(Layoutf('t=t10#1;l=l10#1;b=b10#1;r%r50#1',(self,)))
17
18 self.panelB = wxWindow(self, -1, wxPyDefaultPosition, wxPyDefaultSize, wxSIMPLE_BORDER)
19 self.panelB.SetBackgroundColour(wxRED)
20 self.panelB.SetConstraints(Layoutf('t=t10#1;r=r10#1;b%b30#1;l>10#2', (self,self.panelA)))
21
22 self.panelC = wxWindow(self, -1, wxPyDefaultPosition, wxPyDefaultSize, wxSIMPLE_BORDER)
23 self.panelC.SetBackgroundColour(wxWHITE)
24 self.panelC.SetConstraints(Layoutf('t_10#3;r=r10#1;b=b10#1;l>10#2', (self,self.panelA,self.panelB)))
25
26 b = wxButton(self.panelA, 100, ' Panel A ')
27 b.SetConstraints(Layoutf('X=X#1;Y=Y#1;h*;w%w50#1', (self.panelA,)))
28
29 b = wxButton(self.panelB, 100, ' Panel B ')
30 b.SetConstraints(Layoutf('t=t2#1;r=r4#1;h*;w*', (self.panelB,)))
31
32 self.panelD = wxWindow(self.panelC, -1, wxPyDefaultPosition, wxPyDefaultSize, wxSIMPLE_BORDER)
33 self.panelD.SetBackgroundColour(wxGREEN)
34 self.panelD.SetConstraints(Layoutf('b%h50#1;r%w50#1;h=h#2;w=w#2', (self.panelC, b)))
35
36 b = wxButton(self.panelC, 100, ' Panel C ')
37 b.SetConstraints(Layoutf('t_#1;l>#1;h*;w*', (self.panelD,)))
38
39 wxStaticText(self.panelD, -1, "Panel D", wxPoint(4, 4)).SetBackgroundColour(wxGREEN)
40
41 def OnButton(self, event):
42 wxBell()
43
44
45
46 #---------------------------------------------------------------------------
47
48 def runTest(frame, nb, log):
49 win = TestLayoutf(nb)
50 return win
51
52 #---------------------------------------------------------------------------
53
54
55
56
57
58
59
60
61
62 overview = Layoutf.__doc__