wx.SplitterWindow with Different Minimum Panel Sizes

https://docs.wxpython.org/wx.SplitterWindow.html

It seems that the .SetMinimumPaneSize() method takes only a single value, while I need a different minimum size for the left pane and the right pane.

I have tried setting minimum panel sizes with .SetMinSize() on the panels in the splitter panes, but the splitter seems happy to ignore that.

I’m wondering how to enforce these minimum sizes. I guess I could try to capture the events and use that to force the sash position somehow. Has anyone done something like this before?
EVT_SPLITTER_SASH_POS_CHANGING
EVT_SPLITTER_SASH_POS_RESIZE
EVT_SPLITTER_SASH_POS_CHANGED

I’ve not tried it, but my first thought would be to have an EVT_SPLITTER_SASH_POS_CHANGING handler which checks event.GetSashPosition() and then calls event.SetSashPosition(-1) to not allow the change when the position goes above or below the required limits.

Yes, this is working. I can see this mostly working already, I just need to polish some details w.r.t. my sizes. Thanks for the event.SetSashPosition(-1) idea, I probably wouldn’t have thought of that.

I stole it from the wxPython demo :wink:

1 Like