Nathan McCorkle
2014-07-29 23:28:00 UTC
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])
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])
--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to wxpython-users+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to wxpython-users+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.