There wx.BoxSizer
no gap parameter in wx.BoxSizer (is there a GridSizer, as you said). The way to create a space is to set the border in your widgets. This can be done with the styles: wx.ALL
, wx.BOTTOM
and / or wx.TOP
.
For instance:
szr = wx.BoxSizer(wx.VERTICAL) szr.Add(self.button_1, 0, wx.TOP|wx.BOTTOM|wx.ALIGN_CENTER_HORIZONTAL, 5)
will add a centered widget (button in my code) in the field with a 5-point border above and below.
Show if you write:
vgap = 5 szr = wx.BoxSizer(wx.VERTICAL) szr.Add(self.button_1, 0, wx.TOP, vgap) szr.Add(self.button_2, 0, wx.TOP, vgap) szr.Add(self.button_3, 0, wx.TOP, vgap)
you get 3 buttons, similar to what you would have with SetVGap
, and you can control the separation between the slots by installing vgap.
Like the other answers, you can also insert separators between your widgets to get the same effect, but it seems to me cleaner (without the extra lines "sizer.add") if what you want is equivalent to the vgap grid.
source share