SplitterWindow SetMinimumPaneSize for each pane, rather than one size for both?

Since the SplitterWindow doesn’t seem to respect a contained sizer’s ‘best size’, I tried to get around this by setting the minimum pane size to the panel’s GetBestSize X component.

The panel had some buttons that were getting squashed and eventually hidden when the sash was moved, it wasn’t being limited by the sizers.

Here’s a very stripped down version of the class

class mySplitter(wx.SplitterWindow):

def __init__(self, parent):

    #add panels with nested sizers and add widgets to them

    #add the bottom row of buttons to their own sizer

    self.lowerBottomRowButtonHSizer = wx.BoxSizer(wx.HORIZONTAL)

    self.lowerBottomRowButtonHSizer.AddF(radio1, wx.SizerFlags(0).Center())

    self.lowerBottomRowButtonHSizer.AddF(radio2, wx.SizerFlags(0).Center())

    self.lowerBottomRowButtonHSizer.AddF(radio3, wx.SizerFlags(0).Center())

    self.lowerBottomRowButtonHSizer.AddF(btn1, wx.SizerFlags(0).Center())

    self.lowerBottomRowButtonHSizer.AddF(btn2, wx.SizerFlags(0).Center())

    self.lowerBottomRowButtonHSizer.AddF(btn3, wx.SizerFlags(0).Center())

    self.lowerBottomRowButtonHSizer.AddF(self.BtnReadTDO, wx.SizerFlags(0).Center())

    self.lowerBottomRowButtonHSizer.AddF(self.BtnUndoChanges, wx.SizerFlags(0).Center())

    #self.lowerBottomRowButtonHSizer.SetItemMinSize(self.BtnUndoChanges, (100,100))

    #create a vertical sizer to stack the buttons on top of the list

    rightVSizer = wx.BoxSizer(wx.VERTICAL)

    rightVSizer.AddF(rightSpinButtonSearchHistory, wx.SizerFlags(0).Expand())

    rightVSizer.AddF(self.registerTree, wx.SizerFlags(1).Expand())

    rightVSizer.AddF(lowerUpperRowButtonHSizer, wx.SizerFlags(0).Expand())

    rightVSizer.AddF(self.lowerBottomRowButtonHSizer, wx.SizerFlags(0).Expand())

    #add the left and right V-Sizers to the left and right StaticBoxSizers (this adds a border around the group of elements)

    leftBSizer.AddF(leftVSizer, wx.SizerFlags(1).Expand())

    rightBSizer.AddF(rightVSizer, wx.SizerFlags(1).Expand())

    # Set the size of the left panel to that required by the tree

    leftPanel.SetSizer(leftBSizer) #leftVSizer)

    rightPanel.SetSizer(rightBSizer)

    # Put the left and right panes into the split window

    self.SplitVertically(leftPanel, rightPanel)

    

    self.SetMinimumPaneSize(rightPanel.GetBestSize()[0])

Just fought with this again yesterday on a new GUI… I had to manually tell each of my panels, tell the Notebook I’m using, tell the SplitterWindows what ‘MinimumSize’ they should use, even though they all had a decent ‘BestSize’. It really seems like the default here is backwards, where the nested sizers isn’t respected. Sorry I don’t have code to post to demonstrate… but it was really frustrating tweaking sizer.Add call options and trying the different Set MinimumSize methods.

···

On Tuesday, July 29, 2014 4:28:00 PM UTC-7, Nathan McCorkle wrote:

Since the SplitterWindow doesn’t seem to respect a contained sizer’s ‘best size’, I tried to get around this by setting the minimum pane size to the panel’s GetBestSize X component.

The panel had some buttons that were getting squashed and eventually hidden when the sash was moved, it wasn’t being limited by the sizers.

    self.SetMinimumPaneSize(rightPanel.GetBestSize()[0])