I’m trying to lay out a window with a 3:1 height ratio for a wx.grid.Grid (3) and a wx.Button (1). This sounds like a job for a BoxSizer! So I wrote this:
frame = wx.Frame(None, title="Hello World")
sizer = wx.BoxSizer(wx.VERTICAL)
grid = sudoku_9x9grid(frame)
sizer.Add(grid, 3, wx.EXPAND, 8)
button = wx.Button(frame, label="GO BUTTON")
sizer.Add(button, 1, wx.SHAPED | wx.ALIGN_CENTER)
# Show it.
frame.SetSizerAndFit(sizer)
frame.Show()
# Start the event loop.
app.MainLoop()
It works as intended when I’m dragging the window large, but when I drag the window smaller, the sizer doesn’t maintain the height ratio I intended:
I’m sure I’m doing something wrong setting flags to the Sizer, but I haven’t figured out what. Any suggestions?