Spacing of icons in a vertical ToolBook

I’ve got a toolbook with the toolbar on the left, and have assigned an imagelist and added pages, much like in the demo app. It looks pretty much how I want it, except that the icons are packed too closely together.

is it possible to affect the icon spacing somehow?

Thanks
Neil

Hi Neil,

I don’t see that icons are packed “too closely”. Could you post your code or snapshot?
I wrote a short sample code and it seems no problem to me:

import wx

## Try one of them
## book_type = wx.Notebook
## book_type = wx.Treebook
## book_type = wx.Listbook
book_type = wx.Toolbook

class Book(book_type):
    def __init__(self, parent):
        super().__init__(parent, style=wx.BK_DEFAULT|wx.BK_LEFT)
        
        bmp = wx.ArtProvider.GetBitmap(wx.ART_PLUS, size=(16,16))
        self.li = wx.ImageList(16, 16)
        self.li.Add(bmp)
        self.AssignImageList(self.li)
        
        for x in range(5):
            win = wx.TextCtrl(self)
            self.AddPage(win, "page-{}".format(x), imageId=0)

if __name__ == "__main__":
    app = wx.App()
    frm = wx.Frame(None)
    frm.nb = Book(frm)
    frm.Show()
    app.MainLoop()

image

That’s shows exactly what I mean, there is zero spacing between the icons. I’m not saying that there’s a problem that they’re overlapping or anything like that, just that I want to put some extra vertical spacing between them

Actually, I just realised that I can achieve what I want by adding the padding to the icons themselves. It’s a bit clumsy, having to go and edit the icon files to get the look that I want, but it works ok.

Neil,

Try wx.ToolBar.InsertStretchableSpace at desired position(s) .

wx.Toolbook is a subclass, inheriting from wx.ToolBar .

Pls share if that provides a viable solution for you.

Thom