Here's the general layout of my GUI:
||Title||||||||||||||||||x|
| |words|
| |blah |
| . . . . | |
| | |
| . | |
| |bttn |
|||||||||||||||||||||||||||
Basically, there are two large panes, the left which resizes according to how big the window is, and the right which stays constant. I'd like to put some interactive widgets in the right panel, such as checkboxes, radio buttons, etc, but the number of things I want to put in may be larger than the size of the whole application. If I want to make that panel scrollable in wxPython (or equivalently, wxWidgets), how would I go about it? Here's my guess:
class MyGUI(wx.Frame):
def __init__(self)
wx.Frame(None, -1)
main_panel = wx.Panel(self,-1)
main_sizer = wx.BoxSizer(wx.HORIZONTAL)
main_panel.SetSizer(main_sizer)
left_panel = wx.Panel(main_panel,-1)
main_sizer.Add(left_panel, 1, wx.EXPAND)
right_panel = wx.Panel(main_panel,-1)
right_sizer = wx.BoxSizer(wx.VERTICAL)
right_panel.SetSizer(right_sizer)
main_sizer.Add(right_panel, 0, wx.EXPAND)
for i in range(100):
right_sizer.Add(wx.CheckBox(right_panel, -1, "Happy Box"), 0, wx.EXPAND)
right_sizer.Add(wx.Button(right_panel, -1, "Grow!"),1, wx.EXPAND)
right_panel.Fit()
main_panel.Fit()
self.Layout()
self.Maximise()
self.Show()
Now I know that wxPython happens to have a nifty little panel called ScrolledPanel, but for one reason or another it doesn't seem to actually recognize how large the right side panel is; which is to say, if I resize the GUI, the scrollbars do not correct themselves. In fact, they're not even right in the first place. How would I go about this sensibly?