wxPython | InsertSeparator() function in wx.ToolBar Last Updated : 05 Apr, 2022 Summarize Comments Improve Suggest changes Share Like Article Like Report In this article we are going to learn about to learn about InsertSeparator() function associated with wx.ToolBar class of wxPython. InsertSeparator() function simply inserts the separator into the toolbar at the given position. Note that you must call Realize for the change to take place. It takes only pos as argument. Syntax: wx.ToolBar.InsertSeparator(self, pos) Parameter : ParameterInput TypeDescriptionposintposition to insert separation starting from 0. Return Type: wx.ToolBarToolBase Code Example 1: Python3 import wx class Example(wx.Frame): def __init__(self, *args, **kwargs): super(Example, self).__init__(*args, **kwargs) self.InitUI() def InitUI(self): self.locale = wx.Locale(wx.LANGUAGE_ENGLISH) self.toolbar = self.CreateToolBar() td = self.toolbar.AddTool(1, '', wx.Bitmap('sep.png')) te = self.toolbar.AddTool(2, '', wx.Bitmap('right.png')) tf = self.toolbar.AddTool(3, '', wx.Bitmap('wrong.png')) self.toolbar.Realize() self.Bind(wx.EVT_TOOL, self.OnOne, td) self.SetSize((350, 250)) self.SetTitle('Undo redo') self.Centre() def OnOne(self, e): # insert separator b / w tick and cross tool self.toolbar.InsertSeparator( pos = 2) self.toolbar.Realize() def OnQuit(self, e): self.Close() def main(): app = wx.App() ex = Example(None) ex.Show() app.MainLoop() if __name__ == '__main__': main() Output: before clicking separate icon: after clicking separate icon: Code Example 2: Python3 import wx class Example(wx.Frame): def __init__(self, *args, **kwargs): super(Example, self).__init__(*args, **kwargs) self.InitUI() def InitUI(self): self.locale = wx.Locale(wx.LANGUAGE_ENGLISH) self.toolbar = self.CreateToolBar() td = self.toolbar.AddTool(1, '', wx.Bitmap('sep.png')) te = self.toolbar.AddTool(2, '', wx.Bitmap('right.png')) tf = self.toolbar.AddTool(3, '', wx.Bitmap('wrong.png')) self.toolbar.Realize() self.Bind(wx.EVT_TOOL, self.OnOne, td) self.SetSize((350, 250)) self.SetTitle('Undo redo') self.Centre() def OnOne(self, e): for i in range(5): # insert 5 separator tick and cross tool self.toolbar.InsertSeparator( pos = 2) self.toolbar.Realize() def OnQuit(self, e): self.Close() def main(): app = wx.App() ex = Example(None) ex.Show() app.MainLoop() if __name__ == '__main__': main() Output: before clicking separate icon: after clicking separate icon: Comment More infoAdvertise with us Next Article wxPython - InsertStretchableSpace() function in wx.ToolBar R RahulSabharwal Follow Improve Article Tags : Python Python-wxPython Practice Tags : python Similar Reads wxPython - InsertTool() function in wx.ToolBar In this article we are going to learn about InsertTool() function associated with wx.ToolBar class of wxPython. InsertTool() function is the new style of inserting a tool in the toolbar as a particular position. InsertTool() takes arguments associated with a tool as its parameters. Syntax: wx.ToolBa 2 min read wxPython - SetToolSeparation() function in wx.ToolBar In this article we are going to learn about SetToolSeparation() function associated with the wx.ToolBar class of wxPython.SetToolSeparation() sets the default separator size. The default value is 5. SetToolSeparation() function only takes separation() as parameters. Syntax: wx.ToolBar.SetToolSeparat 1 min read wxPython | InsertLabelTool() function in wx.ToolBar In this article we are going to learn about InsertLabelTool() function associated with class wx.ToolBar in wxPython. InsertLabelTool() is an old style method to insert a tool in the toolbar. InsertLabelTool() takes different property of tool as parameters to insert tool. Syntax : wx.ToolBar.InsertLa 2 min read wxPython | InsertControl() function in wx.ToolBar In this article, we are going to learn about InsertControl() function associated with wx.ToolBar class of wxPython. InsertControl() inserts the control into the toolbar at the given position. Note that You must call Realize for the change to take place. Syntax : wx.ToolBar.InsertControl(self, pos, c 2 min read wxPython - InsertStretchableSpace() function in wx.ToolBar In this article we are going to learn about InsertStretchableSpace() function associated with wx.ToolBar class of wxPython. InsertStretchableSpace() inserts a stretchable space at the given position. Note that change will take place after Realize() is called. It takes only pos as parameter. Syntax: 2 min read wxPython - SetMargins() function in wx.ToolBar In this article we are going to learn about SetMargins() function associated with wx.ToolBar class of wxPython. SetMargins() function set the values to be used as margins for the toolbar. It takes two integer x and y as parameter for left and right margins. Syntax: wx.ToolBar.SetMargins(self, x, y) 1 min read Like