]>
git.saurik.com Git - wxWidgets.git/blob - wxPython/demo/Layoutf.py
2 from wxPython
.wx
import *
3 from wxPython
.lib
.layoutf
import Layoutf
5 #---------------------------------------------------------------------------
7 class TestLayoutf(wxPanel
):
8 def __init__(self
, parent
):
9 wxPanel
.__init
__(self
, parent
, -1)
11 self
.SetAutoLayout(True)
12 EVT_BUTTON(self
, 100, self
.OnButton
)
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
,)))
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
)))
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
)))
26 b
= wxButton(self
.panelA
, 100, ' Panel A ')
27 b
.SetConstraints(Layoutf('X=X#1;Y=Y#1;h*;w%w50#1', (self
.panelA
,)))
29 b
= wxButton(self
.panelB
, 100, ' Panel B ')
30 b
.SetConstraints(Layoutf('t=t2#1;r=r4#1;h*;w*', (self
.panelB
,)))
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
)))
36 b
= wxButton(self
.panelC
, 100, ' Panel C ')
37 b
.SetConstraints(Layoutf('t_#1;l>#1;h*;w*', (self
.panelD
,)))
39 wxStaticText(self
.panelD
, -1, "Panel D", wxPoint(4, 4)).SetBackgroundColour(wxGREEN
)
41 def OnButton(self
, event
):
46 #---------------------------------------------------------------------------
48 def runTest(frame
, nb
, log
):
52 #---------------------------------------------------------------------------
62 overview
= Layoutf
.__doc
__
67 if __name__
== '__main__':
70 run
.main(['', os
.path
.basename(sys
.argv
[0])])