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