I'm trying to decide between DynamicSashWindow and MultiSash to represent multiple views of a ListCtrl.
I'm in the DynamicSashWindow part of my exploration, and I am absolutely flummoxed by how to do
this. I have the layout something like approximately correct, and I have the OnSplit handler firing, but
I can't for the life of me figure out how to attach a new view of the same tree data. Any nudges in the right
direction would be greatly appreciated.
Thanks,
Danny
#%<-----------------------------------------------------------------------
import wx
import wx.gizmos
class MainFrame(wx.Frame):
def __init__(self, *args, **kwargs):
super(MainFrame,self).__init__(*args, **kwargs)
self.comboPanel = ComboPanel(self,wx.ID_ANY)
self.Show(True)
class ComboPanel(wx.Panel):
def __init__(self, *args, **kwargs):
super(ComboPanel, self).__init__(*args, **kwargs)
self.splitter=wx.SplitterWindow(self, wx.ID_ANY)
self.splitter.SetMinimumPaneSize(100)
self.dsw = wx.gizmos.DynamicSashWindow(self.splitter,wx.ID_ANY)
self.tree = MyTree(self.dsw)
self.rightPanel=RightPanel(self.splitter, wx.ID_ANY)
self.splitter.SplitVertically(self.dsw, self.rightPanel, -200)
mainSizer = wx.BoxSizer(wx.VERTICAL)
mainSizer.Add(self.splitter, proportion=1, flag=wx.EXPAND|wx.ALL, border=20)
self.SetSizer(mainSizer)
class MyTree(wx.TreeCtrl):
def __init__(self, parent):
super(MyTree, self).__init__(parent, wx.ID_ANY, style=wx.TR_HAS_BUTTONS|wx.TR_EDIT_LABELS|wx.TR_LINES_AT_ROOT)
self.AddRoot("root")
font=self.GetFont()
font.SetPointSize(10)
self.SetFont(font)
self.dyn_sash= parent
self.Bind(wx.gizmos.EVT_DYNAMIC_SASH_SPLIT, self.OnSplit)
def OnSplit(self, evt):
# What do I do here to get a different view of "self"???
class RightPanel(wx.Panel):
def __init__(self, *args, **kwargs):
super(RightPanel, self).__init__(*args, **kwargs)
bottomlabel = wx.StaticText(self, -1,"Properties Editor", (5,5))
class App(wx.App):
def OnInit(self):
self.title = 'Logic Model'
self.mainFrame = MainFrame(None, wx.ID_ANY,self.title ,size=(750, 750),pos=(0,0),
style=wx.DEFAULT_FRAME_STYLE|wx.NO_FULL_REPAINT_ON_RESIZE)
return True
app = App(0)
app.MainLoop()