I can't figure out what I'm doing wrong. I just made the jump from Tkinter to wxPython and I'm trying to figure out BoxSizers. I'd look this question up, but I don't even know what to look up. This panel is filling the space of a Frame, it's supposed to show a line of text with a progressbar underneath it and that's all supposed to take up the bottom 1/5 of the panel or so, centered horizontally (eventually I'm going to add a background image behind it). But what happens is I only see the text and only about 40% down from the top, aligned to the left edge of the window. Here's the code:
class KhPanel(wx.Panel):
def __init__(self, parent, configSet, selectWindow):
wx.Panel.__init__(self, parent=parent)
self.frame = parent
self.configSet = configSet
whichWindow = getattr(self, selectWindow)
whichWindow()
def configWindow(self):
gaugeWidth = (1/5)*self.configSet["width"]
gaugeHeight = (1/10)*self.configSet["height"]
gaugeMax = 100
topBuffer = (8/10)*self.configSet["height"]
itemSep = (1/16)*self.configSet["height"]
vSizer = wx.BoxSizer(wx.VERTICAL)
textSizer = wx.BoxSizer(wx.HORIZONTAL)
progressSizer = wx.BoxSizer(wx.HORIZONTAL)
configText = wx.StaticText(self, label="STUFF", style=wx.ALIGN_CENTER)
configProgressBar = wx.Gauge(self, range=gaugeMax, size=(gaugeWidth, gaugeHeight))
textSizer.Add(configText, 1, wx.ALIGN_CENTER, 0)
progressSizer.Add(configProgressBar, 1, wx.ALIGN_CENTER, 1)
vSizer.Add(textSizer, 1, wx.TOP, topBuffer)
vSizer.Add(progressSizer, 1, wx.TOP, itemSep)
self.SetSizer(vSizer)
vSizer.Fit(self)
return
If you need the info, configSet.width and height are the width and height of the parent window (currently 340 x 270). And selectWindow, in this case, is "configWindow"