Demo updates for new wx namespace, from Jeff Grimmett
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@24723 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
		@@ -1,45 +1,62 @@
 | 
			
		||||
# 11/12/2003 - Jeff Grimmett (grimmtooth@softhome.net)
 | 
			
		||||
#
 | 
			
		||||
# o Updated for wx namespace
 | 
			
		||||
# o Controls now use dynamic IDs instead of hardcoded IDs.
 | 
			
		||||
# 
 | 
			
		||||
 | 
			
		||||
from wxPython.wx          import *
 | 
			
		||||
from wxPython.lib.layoutf import Layoutf
 | 
			
		||||
import  wx
 | 
			
		||||
import  wx.lib.layoutf  as layoutf
 | 
			
		||||
 | 
			
		||||
#---------------------------------------------------------------------------
 | 
			
		||||
 | 
			
		||||
class TestLayoutf(wxPanel):
 | 
			
		||||
ID_Button = wx.NewId()
 | 
			
		||||
 | 
			
		||||
#---------------------------------------------------------------------------
 | 
			
		||||
 | 
			
		||||
class TestLayoutf(wx.Panel):
 | 
			
		||||
    def __init__(self, parent):
 | 
			
		||||
        wxPanel.__init__(self, parent, -1)
 | 
			
		||||
        wx.Panel.__init__(self, parent, -1)
 | 
			
		||||
 | 
			
		||||
        self.SetAutoLayout(True)
 | 
			
		||||
        EVT_BUTTON(self, 100, self.OnButton)
 | 
			
		||||
        self.Bind(EVT_BUTTON, self.OnButton, id=ID_Button)
 | 
			
		||||
 | 
			
		||||
        self.panelA = wxWindow(self, -1, style=wxSIMPLE_BORDER)
 | 
			
		||||
        self.panelA.SetBackgroundColour(wxBLUE)
 | 
			
		||||
        self.panelA.SetConstraints(Layoutf('t=t10#1;l=l10#1;b=b10#1;r%r50#1',(self,)))
 | 
			
		||||
        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,))
 | 
			
		||||
            )
 | 
			
		||||
 | 
			
		||||
        self.panelB = wxWindow(self, -1, style=wxSIMPLE_BORDER)
 | 
			
		||||
        self.panelB.SetBackgroundColour(wxRED)
 | 
			
		||||
        self.panelB.SetConstraints(Layoutf('t=t10#1;r=r10#1;b%b30#1;l>10#2', (self,self.panelA)))
 | 
			
		||||
        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))
 | 
			
		||||
            )
 | 
			
		||||
 | 
			
		||||
        self.panelC = wxWindow(self, -1, style=wxSIMPLE_BORDER)
 | 
			
		||||
        self.panelC.SetBackgroundColour(wxWHITE)
 | 
			
		||||
        self.panelC.SetConstraints(Layoutf('t_10#3;r=r10#1;b=b10#1;l>10#2', (self,self.panelA,self.panelB)))
 | 
			
		||||
        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))
 | 
			
		||||
            )
 | 
			
		||||
 | 
			
		||||
        b = wxButton(self.panelA, 100, ' Panel A ')
 | 
			
		||||
        b.SetConstraints(Layoutf('X=X#1;Y=Y#1;h*;w%w50#1', (self.panelA,)))
 | 
			
		||||
        b = wx.Button(self.panelA, ID_Button, ' Panel A ')
 | 
			
		||||
        b.SetConstraints(layoutf.Layoutf('X=X#1;Y=Y#1;h*;w%w50#1', (self.panelA,)))
 | 
			
		||||
 | 
			
		||||
        b = wxButton(self.panelB, 100, ' Panel B ')
 | 
			
		||||
        b.SetConstraints(Layoutf('t=t2#1;r=r4#1;h*;w*', (self.panelB,)))
 | 
			
		||||
        b = wx.Button(self.panelB, ID_Button, ' Panel B ')
 | 
			
		||||
        b.SetConstraints(layoutf.Layoutf('t=t2#1;r=r4#1;h*;w*', (self.panelB,)))
 | 
			
		||||
 | 
			
		||||
        self.panelD = wxWindow(self.panelC, -1, style=wxSIMPLE_BORDER)
 | 
			
		||||
        self.panelD.SetBackgroundColour(wxGREEN)
 | 
			
		||||
        self.panelD.SetConstraints(Layoutf('b%h50#1;r%w50#1;h=h#2;w=w#2', (self.panelC, b)))
 | 
			
		||||
        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))
 | 
			
		||||
            )
 | 
			
		||||
 | 
			
		||||
        b = wxButton(self.panelC, 100, ' Panel C ')
 | 
			
		||||
        b.SetConstraints(Layoutf('t_#1;l>#1;h*;w*', (self.panelD,)))
 | 
			
		||||
        b = wx.Button(self.panelC, ID_Button, ' Panel C ')
 | 
			
		||||
        b.SetConstraints(layoutf.Layoutf('t_#1;l>#1;h*;w*', (self.panelD,)))
 | 
			
		||||
 | 
			
		||||
        wxStaticText(self.panelD, -1, "Panel D", wxPoint(4, 4)).SetBackgroundColour(wxGREEN)
 | 
			
		||||
        wx.StaticText(self.panelD, -1, "Panel D", (4, 4)).SetBackgroundColour(wx.GREEN)
 | 
			
		||||
 | 
			
		||||
    def OnButton(self, event):
 | 
			
		||||
        wxBell()
 | 
			
		||||
        wx.Bell()
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@@ -51,18 +68,7 @@ def runTest(frame, nb, log):
 | 
			
		||||
 | 
			
		||||
#---------------------------------------------------------------------------
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
overview = Layoutf.__doc__
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
overview = layoutf.Layoutf.__doc__
 | 
			
		||||
 | 
			
		||||
if __name__ == '__main__':
 | 
			
		||||
    import sys,os
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user