Prevent the panels located under the sash from disappearing for a MultiSplitterWindow

Hi all,

I have the following code which generates a MultiSplitterWindow with four panels:

import wx
from wx.lib.splitter import MultiSplitterWindow

class SamplePanel(wx.Panel):
    def __init__(self, parent, colour):
        wx.Panel.__init__(self, parent)

class MainFrame(wx.Frame):
    def __init__(self):
        wx.Frame.__init__(self, None, title="MultiSplitterWindow Tutorial")

        splitter = MultiSplitterWindow(self, style=wx.SP_LIVE_UPDATE)
        colours = ["pink", "yellow", "sky blue", "Lime Green"]

        for colour in colours:
            panel = SamplePanel(splitter, colour) splitter.AppendWindow(panel)


if  __name__ == "__main__":
    app = wx.App(False)
    frame = MainFrame()

When running that code, the SetMinimumPaneSize method produces its effect for the panels located over the sashes but not for the panels located below the sashes. The results of this is that the panels below the sashes can completely disappear. Is that a bug or do I misunderstand something about the SetMinimumPaneSize method ?

Thank you very much


It is not good style to post the same questions on discuss, wxpython-users and Stackoverflow.
This will not motivate people to answer.

thanks for you useful feedback.So as I have to deal with a litigious person, let me explain. Firstly, as always, I put my question on stack but I realized that the number of users on the wxpython channel was quite low reducing the chance to have an answer. Thus I put my question on the old mailing list. Realizing it was somewhat deprecated I put my question on the brand new mailing list. OK ? Otherwise, would you have an answer to give to my question ? Many thanks in advance.

I think if you resize the frame to make it taller, it becomes a little clearer what is happening.

If the sizes of one or more of the upper panes is big enough, then the lower pane, or panes will not be shown because they are clipped by the frame.

When you drag a sash without holding down the Shift key, all the sashes below it will move by the same amount and eventually their panels will be ‘outside’ the panel.

However, when you drag a sash while holding down the Shift key, only that sash will move and the minimum size of the pane below will be enforced.

I think it is working as intended.

I have never used wx.lib.splitter. Generally, the lib code is used, tested and maintained less than the standard wx code. This is not a big problem, as it’s Python code and usually, if there’s a problem, you can take the code and modify it.

With normal splitter windows I never had problems and SetMinimumPaneSize has always worked for me.
I would suggest that you either try to use several ‘normal’ splitters or that you look at the MultiSplitterWindow code yourself to fix the issue.
A good Python debugger is recommended to set breakpoints and step through.
The wxWidgets core code is more difficult to debug as it’s not Python.

If you go for the multi-splitter approach, you may want to try wxGlade. Then you can interactively fine tune pane sizes and sash gravities to come to a good solution.

If you fix the MultiSplitterWindow code, please submit a pull request when you’re done.

The version with three normal splitters also has a small glitch. See attached code. Probably you would need to handle EVT_SPLITTER_SASH_POS_CHANGED to trigger the other splitters to check their position. (2.0 KB) (812 Bytes)

Many thanks for the explanation. Things get clearer now.

Many thanks for the hint. I will try the EVT_SPLITTER_SASH_POS_CHANGED approach.

I’m not the biggest user of the wx.lib, but splitter.SetMinimumPaneSize works as expected, touch wood :stuck_out_tongue_closed_eyes: (‘glitch’ in front of screen ???)