如何使用 wxpython 在工具栏项之间引入垂直线

How to introduce a vertical line between toolbar items using wxpython

我已经创建了包含新项目和打开项目的工具栏。工具栏大小为 (16x16)。如何在这些工具栏项之间引入垂直线?

   self.newToolItem = self.toolBar.AddTool(wx.ID_NEW,'New', \
                         wx.Bitmap(wx.Bitmap("new.png")),"New")
    self.frameinst.Bind(wx.EVT_TOOL,onNew,self.newToolItem)

    # how to introduce a vertical line between between these toolbar items # as a separation between these toolbar items 

    self.openToolItem = self.toolBar.AddTool(wx.ID_OPEN,'Open',\
                            wx.Bitmap(wx.Bitmap("open.png")), "Open")
    self.frameinst.Bind(wx.EVT_TOOL,onOpen,self.openToolItem)

self.toolBar = self.frameInst.CreateToolBar()

通过在工具栏项之间添加分隔符(在代码行下方)解决了问题。

self.toolBar.AddSeparator()

我们可以在您想要分隔工具栏项的地方引入这行代码。