pythonwxpythonboxsizer

How to expand a wx.StaticBox horizontally?


I am having troubles expanding a StaticBox.

Here is the code i am using:

self.images_area = wx.StaticBox(self, -1, '')
self.sizerBox = wx.BoxSizer(wx.HORIZONTAL)
self.sizerBox.Add(self.images_area, 0, wx.EXPAND|wx.ALL, 10)
self.SetSizer(self.sizerBox)

It appears to be working vertically however it does not expand horizontally (which I would have thought the opposite since I used wx.HORIZONTAL in the BoxSizer)


Solution

  • use

    self.sizerBox.Add(self.images_area, 1, wx.EXPAND|wx.ALL, 10)
    

    You have some indications in the wxPyWiki (point 8) of how EXPAND and the proportion parameters work to give the behavior of your widget.