How can I set gap in Vertical BoxSizer? What's in the Vertival BoxSizer the similar or alternative method of SetVGap
(which sets the vertical gap (in pixels) between the cells in the sizer) in GridSizer?
There are several ways to add blank space in a sizer.
sizer = wx.BoxSizer(wx.VERTICAL)
sizer.Add(widget, proportion=0, style=wx.ALL, border=5)
The code above will add the widget with a 5 pixel border on all sides of it. If you want to put some space between two widgets, you can do one of the following:
sizer = wx.BoxSizer(wx.VERTICAL)
sizer.Add(widget, proportion=0, style=wx.ALL, border=5)
sizer.AddSpacer(10)
# or sizer.Add((0,0))
sizer.Add(anotherWidget, proportion=0, style=wx.ALL, border=5)
The nice thing about doing sizer.Add((0,0)) is that you can add it with a proportion of 1 (one) if you want and that will push all the following widgets to the bottom. I use it to give me a little more control over widget placement.
See also http://www.wxpython.org/docs/api/wx.Sizer-class.html