Timothy Smith wrote:
i'm trying to align a wx.grid to the bottom of a sizer, and i appear to be unable to do so. heres my code
self.ChangeTinOut is the grid
ChangeTinOutGridSizer = wx.BoxSizer(wx.VERTICAL)
ChangeTinOutGridSizer.Add(self.ChangeTinOut,2,wx.EXPAND|wx.BOTTOM)
ChangeTinOutGridSizer.Add(self.ChangeTinOutTotal,1,wx.ALIGN_CENTER_VERTICAL) ChangeTinOutGridSizer.Add(self.ChangeTinOutCurrently,1,wx.ALIGN_CENTER_VERTICAL)
That's going to put ChangeTinOut at the TOP of the sizer, letting it expand twice as much as the other two entries. wx.BOTTOM is a flag indicating that you want a border on the bottom.
and wx.ALIGN_CENTER_VERTICAL) doesn't do anything with stretchy items in a vertical sizer.
I'm not entirely sure what you want, but if you set he second parameter to larger than 0, then it will stretch to fit he space, so there really isn't a Bottom to align it with. If you want an item to sit at the bottom of the sizer, with space above it, you need to put a spacer it and let that space stretch:
ChangeTinOutGridSizer = wx.BoxSizer(wx.VERTICAL)
ChangeTinOutGridSizer.Add(self.ChangeTinOutTotal,1,wx.ALIGN_CENTER_VERTICAL)
ChangeTinOutGridSizer.Add(self.ChangeTinOutCurrently,1,wx.ALIGN_CENTER_VERTICAL)
ChangeTinOutGridSizer.Add((1,1), 1) # this adds a 1X1 spacer that will stretch
ChangeTinOutGridSizer.Add(self.ChangeTinOut,0,wx.EXPAND|wx.BOTTOM)
Have read all the docs in the Wiki about Sizers? They should help.
-Chris
···
--
Christopher Barker, Ph.D.
Oceanographer
NOAA/OR&R/HAZMAT (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
Chris.Barker@noaa.gov