1999-04-29 23:29:54 -04:00
|
|
|
|
2003-12-08 20:23:28 -05:00
|
|
|
import wx
|
|
|
|
import wx.lib.layoutf as layoutf
|
1999-04-29 23:29:54 -04:00
|
|
|
|
|
|
|
#---------------------------------------------------------------------------
|
|
|
|
|
2003-12-08 20:23:28 -05:00
|
|
|
class TestLayoutf(wx.Panel):
|
1999-04-29 23:29:54 -04:00
|
|
|
def __init__(self, parent):
|
2003-12-08 20:23:28 -05:00
|
|
|
wx.Panel.__init__(self, parent, -1)
|
1999-04-29 23:29:54 -04:00
|
|
|
|
2003-03-25 01:35:27 -05:00
|
|
|
self.SetAutoLayout(True)
|
2004-01-12 22:17:17 -05:00
|
|
|
self.Bind(wx.EVT_BUTTON, self.OnButton)
|
1999-04-29 23:29:54 -04:00
|
|
|
|
2003-12-08 20:23:28 -05:00
|
|
|
self.panelA = wx.Window(self, -1, style=wx.SIMPLE_BORDER)
|
|
|
|
self.panelA.SetBackgroundColour(wx.BLUE)
|
|
|
|
self.panelA.SetConstraints(
|
|
|
|
layoutf.Layoutf('t=t10#1;l=l10#1;b=b10#1;r%r50#1',(self,))
|
|
|
|
)
|
1999-04-29 23:29:54 -04:00
|
|
|
|
2003-12-08 20:23:28 -05:00
|
|
|
self.panelB = wx.Window(self, -1, style=wx.SIMPLE_BORDER)
|
|
|
|
self.panelB.SetBackgroundColour(wx.RED)
|
|
|
|
self.panelB.SetConstraints(
|
|
|
|
layoutf.Layoutf('t=t10#1;r=r10#1;b%b30#1;l>10#2', (self,self.panelA))
|
|
|
|
)
|
1999-04-29 23:29:54 -04:00
|
|
|
|
2003-12-08 20:23:28 -05:00
|
|
|
self.panelC = wx.Window(self, -1, style=wx.SIMPLE_BORDER)
|
|
|
|
self.panelC.SetBackgroundColour(wx.WHITE)
|
|
|
|
self.panelC.SetConstraints(
|
|
|
|
layoutf.Layoutf('t_10#3;r=r10#1;b=b10#1;l>10#2', (self,self.panelA,self.panelB))
|
|
|
|
)
|
1999-04-29 23:29:54 -04:00
|
|
|
|
2004-01-12 22:17:17 -05:00
|
|
|
b = wx.Button(self.panelA, -1, ' Panel A ')
|
2003-12-08 20:23:28 -05:00
|
|
|
b.SetConstraints(layoutf.Layoutf('X=X#1;Y=Y#1;h*;w%w50#1', (self.panelA,)))
|
1999-04-29 23:29:54 -04:00
|
|
|
|
2004-01-12 22:17:17 -05:00
|
|
|
b = wx.Button(self.panelB, -1, ' Panel B ')
|
2003-12-08 20:23:28 -05:00
|
|
|
b.SetConstraints(layoutf.Layoutf('t=t2#1;r=r4#1;h*;w*', (self.panelB,)))
|
1999-04-29 23:29:54 -04:00
|
|
|
|
2003-12-08 20:23:28 -05:00
|
|
|
self.panelD = wx.Window(self.panelC, -1, style=wx.SIMPLE_BORDER)
|
|
|
|
self.panelD.SetBackgroundColour(wx.GREEN)
|
|
|
|
self.panelD.SetConstraints(
|
|
|
|
layoutf.Layoutf('b%h50#1;r%w50#1;h=h#2;w=w#2', (self.panelC, b))
|
|
|
|
)
|
1999-04-29 23:29:54 -04:00
|
|
|
|
2004-01-12 22:17:17 -05:00
|
|
|
b = wx.Button(self.panelC, -1, ' Panel C ')
|
2003-12-08 20:23:28 -05:00
|
|
|
b.SetConstraints(layoutf.Layoutf('t_#1;l>#1;h*;w*', (self.panelD,)))
|
1999-04-29 23:29:54 -04:00
|
|
|
|
2003-12-08 20:23:28 -05:00
|
|
|
wx.StaticText(self.panelD, -1, "Panel D", (4, 4)).SetBackgroundColour(wx.GREEN)
|
1999-04-29 23:29:54 -04:00
|
|
|
|
|
|
|
def OnButton(self, event):
|
2003-12-08 20:23:28 -05:00
|
|
|
wx.Bell()
|
1999-04-29 23:29:54 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
def runTest(frame, nb, log):
|
|
|
|
win = TestLayoutf(nb)
|
|
|
|
return win
|
|
|
|
|
|
|
|
#---------------------------------------------------------------------------
|
|
|
|
|
2003-12-08 20:23:28 -05:00
|
|
|
overview = layoutf.Layoutf.__doc__
|
2003-07-02 19:13:10 -04:00
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
import sys,os
|
|
|
|
import run
|
|
|
|
run.main(['', os.path.basename(sys.argv[0])])
|
|
|
|
|