A minimal example is below. I have a frame with two panels left and right that I’d like of equal width. The right panel has a Grid. Now if that grid has too many cells, it will expand and take over the left panel. If there are items on the left panel (say buttons) it will not take them over, but it will effectively shrink the left panel as much as possible.
How can I ensure my grid on the right hand side doesn’t take more than half the frame? I just want scrollbars if there are two many cells.
Thanks a lot!
import wx from wx.grid import Grid class TestWindow(wx.Frame): def __init__(self): wx.Frame.__init__(self, None, wx.ID_ANY, "GridTest", size=(800, 600)) sizer = wx.BoxSizer(wx.HORIZONTAL) panel_one = wx.Panel(self) panel_two = wx.Panel(self) panel_two_sizer = wx.BoxSizer(wx.VERTICAL) grid = Grid(panel_two) grid.CreateGrid(2, 20) # it would work fine with a 2x2 grid panel_two_sizer.Add(grid, 1, wx.EXPAND) panel_two.SetSizer(panel_two_sizer) sizer.Add(panel_one, proportion=1, wx.EXPAND) sizer.Add(panel_two, proportion=1, wx.EXPAND)
self.SetSizer(sizer) pass if __name__ == "__main__": app = wx.App() frame = TestWindow().Show() app.MainLoop()