Hi ,
I don’t know if I am trying something stupid here … But I was thinking I could do something like the code below…
code is generated using boa and using
import wx
wx.version
‘2.6.1.0’
import sys, os
import wx
import wx
[wxID_FRAME1, wxID_FRAME1BUTTON1, wxID_FRAME1BUTTON2, wxID_FRAME1BUTTON3,
wxID_FRAME1BUTTON4, wxID_FRAME1FRAMEBASEPNL, wxID_FRAME1LEFTLISTPNL,
wxID_FRAME1LEFTTREEPNL, wxID_FRAME1RIGHTPNL,
] = [wx.NewId() for _init_ctrls in range(9)]
class Frame1(wx.Frame):
def _init_coll_frameSizer_Items(self, parent):
# generated method, don’t edit
parent.AddWindow(self.frameBasePnl, 1, border=0, flag=wx.EXPAND)
def _init_coll_basePnlSzr_Items(self, parent):
# generated method, don’t edit
parent.AddWindow(self.leftTreePnl, 1, border=0, flag=wx.EXPAND)
parent.AddWindow(self.rightPnl, 0, border=0,
flag=wx.EXPAND | wx.ALIGN_RIGHT)
def _init_sizers(self):
# generated method, don’t edit
self.frameSizer = wx.BoxSizer(orient=wx.VERTICAL)
self.basePnlSzr = wx.BoxSizer(orient=wx.HORIZONTAL)
self._init_coll_frameSizer_Items(self.frameSizer)
self._init_coll_basePnlSzr_Items(self.basePnlSzr)
self.SetSizer(self.frameSizer)
self.frameBasePnl.SetSizer(self.basePnlSzr)
def _init_ctrls(self, prnt):
# generated method, don’t edit
wx.Frame.init(self, id=wxID_FRAME1, name=‘’, parent=prnt,
pos=wx.Point(381, 161), size=wx.Size(400, 250),
style=wx.DEFAULT_FRAME_STYLE, title=‘Frame1’)
self.SetClientSize(wx.Size(392, 223))
self.frameBasePnl = wx.Panel(id=wxID_FRAME1FRAMEBASEPNL,
name=u’frameBasePnl’, parent=self, pos=wx.Point(0, 0),
size=wx.Size(392, 223), style=wx.TAB_TRAVERSAL)
self.leftTreePnl = wx.Panel(id=wxID_FRAME1LEFTTREEPNL,
name=u’leftTreePnl’, parent=self.frameBasePnl, pos=wx.Point(0, 0),
size=wx.Size(190, 223), style=wx.TAB_TRAVERSAL)
self.leftTreePnl.SetBackgroundColour(wx.Colour(255, 0, 0))
self.rightPnl = wx.Panel(id=wxID_FRAME1RIGHTPNL, name=u’rightPnl’,
parent=self.frameBasePnl, pos=wx.Point(190, 0), size=wx.Size(202,
223), style=wx.TAB_TRAVERSAL)
self.rightPnl.SetBackgroundColour(wx.Colour(0, 255, 0))
self.leftListPnl = wx.Panel(id=wxID_FRAME1LEFTLISTPNL,
name=u’leftListPnl’, parent=self.frameBasePnl, pos=wx.Point(16,
176), size=wx.Size(200, 100), style=wx.TAB_TRAVERSAL)
self.leftListPnl.SetBackgroundColour(wx.Colour(0, 0, 255))
self.button1 = wx.Button(id=wxID_FRAME1BUTTON1, label=u’treeView’,
name=‘button1’, parent=self.rightPnl, pos=wx.Point(32, 168),
size=wx.Size(75, 23), style=0)
self.button1.Bind(wx.EVT_BUTTON, self.OnButton1Button,
id=wxID_FRAME1BUTTON1)
self.button2 = wx.Button(id=wxID_FRAME1BUTTON2, label=u’listView’,
name=‘button2’, parent=self.rightPnl, pos=wx.Point(120, 168),
size=wx.Size(75, 23), style=0)
self.button2.Bind(wx.EVT_BUTTON, self.OnButton2Button,
id=wxID_FRAME1BUTTON2)
self.button3 = wx.Button(id=wxID_FRAME1BUTTON3,
label=u’I am tree red Click’, name=‘button3’, parent=self.leftTreePnl,
pos=wx.Point(48, 80), size=wx.Size(104, 40), style=0)
self.button3.Bind(wx.EVT_BUTTON, self.OnButton3Button,
id=wxID_FRAME1BUTTON3)
self.button4 = wx.Button(id=wxID_FRAME1BUTTON4,
label=u’I am List blue click me’, name=‘button4’,
parent=self.leftListPnl, pos=wx.Point(48, 80), size=wx.Size(104,
40), style=0)
self.button4.Bind(wx.EVT_BUTTON, self.OnButton4Button,
id=wxID_FRAME1BUTTON4)
self._init_sizers()
def init(self, parent):
self._init_ctrls(parent)
#this is weird I raise the listpanel which is blue u will see full red
self.leftListPnl.Raise()
self.Refresh()
def OnButton1Button(self, event):
self.basePnlSzr.RemoveWindow(0)
self.basePnlSzr.RemoveWindow(0)
self.basePnlSzr.AddWindow(self.leftTreePnl, 1, border=0, flag=wx.EXPAND)
self.basePnlSzr.AddWindow(self.rightPnl, 0, border=0,
flag=wx.EXPAND | wx.ALIGN_RIGHT)
#i don't know why I am raising the wrong but that seems to work in some case
self.leftListPnl.Raise()
self.Refresh()
def OnButton2Button(self, event):
self.basePnlSzr.RemoveWindow(0)
self.basePnlSzr.RemoveWindow(0)
self.basePnlSzr.AddWindow(self.leftListPnl, 1, border=0, flag=wx.EXPAND)
self.basePnlSzr.AddWindow(self.rightPnl, 0, border=0,
flag=wx.EXPAND | wx.ALIGN_RIGHT)
#i don’t know why I am raising the wrong but that seems to work in some case
self.leftTreePnl.Raise()
self.Refresh()
def OnButton4Button(self, event):
print " u clicked list which is blue"
event.Skip()
def OnButton3Button(self, event):
print " u clicked tree which is red"
event.Skip()
class App(wx.App):
def OnInit(self):
self.main = Frame1(None)
self.main.Show()
self.SetTopWindow(self.main)
return True
app = App(0)
app.MainLoop()
···
Thomas Thomas
phone +64 7 855 8478
fax +64 7 855 8871