]> git.saurik.com Git - wxWidgets.git/blame - wxPython/demo/Layoutf.py
wxX11 Unicode compilation fix
[wxWidgets.git] / wxPython / demo / Layoutf.py
CommitLineData
cf694132 1
8fa876ca
RD
2import wx
3import wx.lib.layoutf as layoutf
cf694132
RD
4
5#---------------------------------------------------------------------------
6
8fa876ca 7class TestLayoutf(wx.Panel):
cf694132 8 def __init__(self, parent):
8fa876ca 9 wx.Panel.__init__(self, parent, -1)
cf694132 10
1e4a197e 11 self.SetAutoLayout(True)
95bfd958 12 self.Bind(wx.EVT_BUTTON, self.OnButton)
cf694132 13
8fa876ca
RD
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,))
18 )
cf694132 19
8fa876ca
RD
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))
24 )
cf694132 25
8fa876ca
RD
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))
30 )
cf694132 31
95bfd958 32 b = wx.Button(self.panelA, -1, ' Panel A ')
8fa876ca 33 b.SetConstraints(layoutf.Layoutf('X=X#1;Y=Y#1;h*;w%w50#1', (self.panelA,)))
cf694132 34
95bfd958 35 b = wx.Button(self.panelB, -1, ' Panel B ')
8fa876ca 36 b.SetConstraints(layoutf.Layoutf('t=t2#1;r=r4#1;h*;w*', (self.panelB,)))
cf694132 37
8fa876ca
RD
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))
42 )
cf694132 43
95bfd958 44 b = wx.Button(self.panelC, -1, ' Panel C ')
8fa876ca 45 b.SetConstraints(layoutf.Layoutf('t_#1;l>#1;h*;w*', (self.panelD,)))
cf694132 46
8fa876ca 47 wx.StaticText(self.panelD, -1, "Panel D", (4, 4)).SetBackgroundColour(wx.GREEN)
cf694132
RD
48
49 def OnButton(self, event):
8fa876ca 50 wx.Bell()
cf694132
RD
51
52
53
54#---------------------------------------------------------------------------
55
56def runTest(frame, nb, log):
57 win = TestLayoutf(nb)
58 return win
59
60#---------------------------------------------------------------------------
61
8fa876ca 62overview = layoutf.Layoutf.__doc__
1fded56b
RD
63
64if __name__ == '__main__':
65 import sys,os
66 import run
8eca4fef 67 run.main(['', os.path.basename(sys.argv[0])] + sys.argv[1:])
1fded56b 68