Hey list,
I've been messing with box sizers this morning, and much to my shock,
my window is actually laid out how I want it! I have two listCtrl
items, one on the left and one on the right, each with three buttons
beneath it. I plan to add a label above each list as well. To do this,
I have a mainSizer, which is horizontal; a vertical sizer for each
side of my window; and a horizontal sizer for each set of buttons. I
add my buttons to the proper horizontal sizers, then add my listCtrl
object and one of the buttons sizers to the proper vertical sizer,
then add both of those to the mainSizer and set that using
self.SetSizer(mainSizer) (I'm subclassing a panel).
Here's my only problem: my lists are vertically tiny. They are plenty
wide enough, but they are both only an inch or so tall. I want them to
fill most of the space in their respective sizers, so my users can see
a lot of data at once. I have the proportions of everything set to 0,
and the proportions of these two listCtrl objects set to 1. What do I
need to do to make these two lists expand vertically? I'll paste my
code below in case that helps. Again, "self" is a subclass of
wx.Panel, which is added to a notebook in a frame elsewhere in the
GUIManager module of the app. Thanks in advance.
self.mainSizer = wx.BoxSizer(wx.HORIZONTAL)
self.tablesControlsSizer = wx.BoxSizer(wx.VERTICAL)
self.recordsControlsSizer = wx.BoxSizer(wx.VERTICAL)
self.tablesButtonsSizer = wx.BoxSizer(wx.HORIZONTAL)
self.recordsButtonsSizer = wx.BoxSizer(wx.HORIZONTAL)
self.tablesButtonsSizer.Add(self.add_button, 0, wx.ALL|wx.ALIGN_LEFT, 10)
self.tablesButtonsSizer.Add(self.edit_button, 0, wx.ALL|wx.ALIGN_CENTER, 10)
self.tablesButtonsSizer.Add(self.delete_button, 0, wx.ALL|wx.ALIGN_RIGHT, 10)
self.recordsButtonsSizer.Add(self.addRecord_button, 0,
wx.ALL|wx.ALIGN_LEFT, 10)
self.recordsButtonsSizer.Add(self.editRecord_button, 0,
wx.ALL|wx.ALIGN_CENTER, 10)
self.recordsButtonsSizer.Add(self.deleteRecord_button, 0,
wx.ALL|wx.ALIGN_RIGHT, 10)
self.tablesControlsSizer.Add(self.items_listControl, 1, wx.EXPAND)
self.tablesControlsSizer.Add(self.tablesButtonsSizer, 0, wx.ALIGN_BOTTOM)
self.recordsControlsSizer.Add(self.records_listControl, 1, wx.EXPAND)
self.recordsControlsSizer.Add(self.recordsButtonsSizer)
self.mainSizer.Add(self.tablesControlsSizer, 1, wx.RIGHT, 15)
self.mainSizer.Add(self.recordsControlsSizer, 1, wx.LEFT, 15)
if self.useHighContrast:
self.items_listControl.SetBackgroundColour("blue")
self.records_listControl.SetBackgroundColour("green")
self.SetBackgroundColour("#000000")
#end if
self.SetAutoLayout(True)
self.SetSizer(self.mainSizer)
self.Layout()