wxPython | GetToolSeparation() function in wxPython

In this article we are going to learn about GetToolSeparation() function associated with wx.ToolBar class of wxPython. GetToolSeparation() function returns the default separator size. GetToolSeparation() function takes no arguments.
Syntax :
wx.ToolBar.GetToolSeparation(self)Parameters :
GetToolSeparation() function takes no arguments.Returns:
Returns the default separator size.Return Type:
int
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)        pnl = wx.Panel(self)        self.toolbar = self.CreateToolBar()Â
        # Add Tools Using AddLabelTool function        rtool = self.toolbar.AddLabelTool(id = 13, label = "Tool one", bitmap = wx.Bitmap('right.png'), shortHelp ="short help 1", longHelp = "Long help associated with simple tool 1")        stool = self.toolbar.AddLabelTool(id = 14, label = "Tool two", bitmap = wx.Bitmap('wrong.png'), shortHelp ="short help 2", longHelp = "Long help associated with simple tool 2")Â
        self.toolbar.Realize()        self.SetSize((350, 250))        self.SetTitle('Control')        self.Centre()Â
        # print tool separation value        print(self.toolbar.GetToolSeparation())Â
Â
def main():Â Â Â Â app = wx.App()Â Â Â Â ex = Example(None)Â Â Â Â ex.Show()Â Â Â Â app.MainLoop()Â
Â
if __name__ == '__main__':Â Â Â Â main() |
Output:
0
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)        pnl = wx.Panel(self)        self.toolbar = self.CreateToolBar()        self.toolbar.SetToolSeparation(12)        # Add Tools Using AddLabelTool function        rtool = self.toolbar.AddLabelTool(id = 13, label = "Tool one", bitmap = wx.Bitmap('right.png'), shortHelp ="short help 1", longHelp = "Long help associated with simple tool 1")        stool = self.toolbar.AddLabelTool(id = 14, label = "Tool two", bitmap = wx.Bitmap('wrong.png'), shortHelp ="short help 2", longHelp = "Long help associated with simple tool 2")Â
        self.toolbar.Realize()        self.SetSize((350, 250))        self.SetTitle('Control')        self.Centre()Â
        # print tool separation value        print(self.toolbar.GetToolSeparation())Â
Â
def main():Â Â Â Â app = wx.App()Â Â Â Â ex = Example(None)Â Â Â Â ex.Show()Â Â Â Â app.MainLoop()Â
Â
if __name__ == '__main__':Â Â Â Â main() |
Output:
12



