]>
git.saurik.com Git - wxWidgets.git/blob - wxPython/demo/Layoutf.py
3 import wx
.lib
.layoutf
as layoutf
5 #---------------------------------------------------------------------------
7 class TestLayoutf(wx
.Panel
):
8 def __init__(self
, parent
):
9 wx
.Panel
.__init
__(self
, parent
, -1)
11 self
.SetAutoLayout(True)
12 self
.Bind(wx
.EVT_BUTTON
, self
.OnButton
)
14 self
.panelA
= wx
.Window(self
, -1, style
=wx
.SIMPLE_BORDER
)
15 self
.panelA
.SetBackgroundColour(wx
.BLUE
)
16 self
.panelA
.SetConstraints(
17 layoutf
.Layoutf('t=t10#1;l=l10#1;b=b10#1;r%r50#1',(self
,))
20 self
.panelB
= wx
.Window(self
, -1, style
=wx
.SIMPLE_BORDER
)
21 self
.panelB
.SetBackgroundColour(wx
.RED
)
22 self
.panelB
.SetConstraints(
23 layoutf
.Layoutf('t=t10#1;r=r10#1;b%b30#1;l>10#2', (self
,self
.panelA
))
26 self
.panelC
= wx
.Window(self
, -1, style
=wx
.SIMPLE_BORDER
)
27 self
.panelC
.SetBackgroundColour(wx
.WHITE
)
28 self
.panelC
.SetConstraints(
29 layoutf
.Layoutf('t_10#3;r=r10#1;b=b10#1;l>10#2', (self
,self
.panelA
,self
.panelB
))
32 b
= wx
.Button(self
.panelA
, -1, ' Panel A ')
33 b
.SetConstraints(layoutf
.Layoutf('X=X#1;Y=Y#1;h*;w%w50#1', (self
.panelA
,)))
35 b
= wx
.Button(self
.panelB
, -1, ' Panel B ')
36 b
.SetConstraints(layoutf
.Layoutf('t=t2#1;r=r4#1;h*;w*', (self
.panelB
,)))
38 self
.panelD
= wx
.Window(self
.panelC
, -1, style
=wx
.SIMPLE_BORDER
)
39 self
.panelD
.SetBackgroundColour(wx
.GREEN
)
40 self
.panelD
.SetConstraints(
41 layoutf
.Layoutf('b%h50#1;r%w50#1;h=h#2;w=w#2', (self
.panelC
, b
))
44 b
= wx
.Button(self
.panelC
, -1, ' Panel C ')
45 b
.SetConstraints(layoutf
.Layoutf('t_#1;l>#1;h*;w*', (self
.panelD
,)))
47 wx
.StaticText(self
.panelD
, -1, "Panel D", (4, 4)).SetBackgroundColour(wx
.GREEN
)
49 def OnButton(self
, event
):
54 #---------------------------------------------------------------------------
56 def runTest(frame
, nb
, log
):
60 #---------------------------------------------------------------------------
62 overview
= layoutf
.Layoutf
.__doc
__
64 if __name__
== '__main__':
67 run
.main(['', os
.path
.basename(sys
.argv
[0])])