I finally did it, thank you for your help. The solution with panels
was not very suitable for me because i have a pretty complex layout so
i use other way to do it. Perhaps the solution i found it's not very
elegant but it's working fine. The only small problem it's that
buttons will flicker a little when i navigate through tree items but i
hope i can solve it somehow.
Something like this:
def OnSelChanged(self, event):
self.item = event.GetItem()
select = self.tree1.GetItemText(self.item)
if self.item:
str1 = "Selected item = %s\n" % select
self.log.SetValue(str1)
if select == 'Demo1':
self.but1.Show ()
self.staticboxstyles.SetLabel("Demo1")
self.Refresh ()
else:
self.but1.Hide ()
if select == 'Demo2':
self.but2.Show ()
self.staticboxstyles.SetLabel("Demo2")
self.Refresh ()
else:
self.but2.Hide ()
if select == 'Demo3':
self.but3.Show ()
self.staticboxstyles.SetLabel("Demo3")
self.Refresh ()
else:
self.but3.Hide ()
= = = Original message = = =
If the TreeBook does what you want it to (it requires wxPython 2.8), use
that. Otherwise, this is the basic idea...
class BasePanel(wx.Panel):
def __init__(self, ...):
...
sz = wx.BoxSizer(wx.VERTICAL)
self.c = []
for i in xrange(10):
self.c.Append(wx.Panel(self))
sz.Add(self.c[-1], 1, wx.EXPAND)
d = wx.Sizer(wx.VERTICAL)
d.Add(wx.StaticText(self.c[-1], -1, "page %i"%i))
self.c[-1].SetSizer(d)
self.c[-1].Hide()
self.SetSizer(sz)
self.c[0].Show()
self.Layout()
...
def choose(self, which):
for i in self.c:
i.Hide()
self.c[which].Show()
self.Layout()
- Josiah
- Show quoted text -
···
___________________________________________________________
Sent by ePrompter, the premier email notification software.
Free download at http://www.ePrompter.com.