0

I'm trying to construct a file selector using 2 GenericDirCtrl which display the files in the selected direcotry beneath them. My question is it better to place the splitter window as a child of the frame and add the Panel containing the control to the splitter window or embed the splitter window in a panel with the panel child of the frame?

asked Nov 26, 2011 at 18:37

1 Answer 1

1

When I used a SplitterWindow, I put it on the frame and gave each side their own panel. But you should be able to do: Frame, Panel, SplitterWindow just as easily.

Here's a generic example:

import wx
import wx.grid as gridlib
########################################################################
class LeftPanel(wx.Panel):
 """"""
 #----------------------------------------------------------------------
 def __init__(self, parent):
 """Constructor"""
 wx.Panel.__init__(self, parent=parent)
 grid = gridlib.Grid(self)
 grid.CreateGrid(25,12)
 sizer = wx.BoxSizer(wx.VERTICAL)
 sizer.Add(grid, 0, wx.EXPAND)
 self.SetSizer(sizer)
########################################################################
class RightPanel(wx.Panel):
 """"""
 #----------------------------------------------------------------------
 def __init__(self, parent):
 """Constructor"""
 wx.Panel.__init__(self, parent=parent)
 txt = wx.TextCtrl(self)
class MyForm(wx.Frame):
 def __init__(self):
 wx.Frame.__init__(self, None, wx.ID_ANY, "Splitter Tutorial")
 splitter = wx.SplitterWindow(self)
 leftP = LeftPanel(splitter)
 rightP = RightPanel(splitter)
 # split the window
 splitter.SplitVertically(leftP, rightP)
 splitter.SetMinimumPaneSize(20)
 sizer = wx.BoxSizer(wx.VERTICAL)
 sizer.Add(splitter, 1, wx.EXPAND)
 self.SetSizer(sizer)
# Run the program
if __name__ == "__main__":
 app = wx.App(False)
 frame = MyForm()
 frame.Show()
 app.MainLoop()
answered Nov 28, 2011 at 16:24
Sign up to request clarification or add additional context in comments.

1 Comment

Thanks Mike, I've used the Frame,Splitter, Panel but the Frame Panel Splitter seemed to have more flexibility. Thanks for your help I'll give it a try.

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.