74271

wxPython Splitter windows and Panels

Question:

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?

Answer1:

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()

Recommend

  • wxPython wx.KeyEvent GetKeyCode()
  • Creating ScrolledWindow in wxPython
  • Retrieving output from Node script in a Grunt task
  • wxpython: How do we remove null byte from string when using textcontrol.GetValue()
  • gsoap multiple wsdls but only one proxy class
  • Python: Decide which scrollbar is moving in ScrolledPanel
  • Is wxpython progressdialog cancel event possible?
  • How to change my wxpython program that read and display rain sensor data from mcp3008 to software sp
  • matplotlib example code not working on python virtual environment
  • MSVC 2015 /Wall has lots of not useful messages
  • CMake Setting up Release and Debug version and Flags
  • scipy.ndimage.zoom result depends on image size
  • Botframework - resize bot chat in width [duplicate]
  • How to convert list into string with quotes in python
  • Why are views not counted if you embed a youtube iframe dynamically using jquery?
  • How to get the click event on sIFR embedded tag in IE?
  • Extjs, handling success or failure when doing a standard submit in a form
  • JSON data through JS/AJAX into PHP
  • calculating number of bytes of each row in an image
  • Dynamically load css stylesheet and wait for it to load
  • Ember.js model to be organised as a tree structure
  • How to disable all widgets inside Panel or inside Composite?
  • Spring Cloud Microservice Architecture Confusion
  • wxPython: displaying multiple widgets in same frame
  • Jackson Parser: ignore deserializing for type mismatch
  • OpenGL ES texture problem, 4 duplicate columns and horizontal lines (Android)
  • Java: can you cast Class into a specific interface?
  • R - Combining Columns to String Based on Logical Match
  • QLineEdit password safety
  • Nant, Vault & Windows Integrated Authentication
  • Bug in WPF DataGrid
  • AES padding and writing the ciphertext to a disk file
  • Updating server-side rendering client-side
  • How to extract text from Word files using C#?
  • jQuery tmpl and DataLink beta
  • How can I estimate amount of memory left with calling System.gc()?
  • How to include full .NET prerequisite for Wix Burn installer
  • embed rChart in Markdown
  • Unable to use reactive element in my shiny app
  • jQuery Masonry / Isotope and fluid images: Momentary overlap on window resize