Search code examples
pythonwxpythonboxsizer

wxpython boxsizer addmany spacer


How can I add a spacer between two items in a boxsizer, while using Add Many? I tried key words like Spacer, AddSpacer and things like that but unfortunately, it didn't work.


Solution

  • AddMany just calls Add, so if you pass (10, 10) as the first item of the tuple, it will be interpreted as a spacer, right? Like:

    AddMany(
        (some_widget, flag=wx.EXPAND),
        ((10, 10),),  # this is a spacer
        (another_widget, flag=wx.EXPAND),
    )
    

    You can also use a border.

    AddMany(
        (some_widget, flag=wx.EXPAND|wx.RIGHT, border=10),
        (another_widget, flag=wx.EXPAND),
    )