Skip to content
Related Articles
Open in App
Not now

Related Articles

wxPython – SetMargins() function in wx.ToolBar

Improve Article
Save Article
Like Article
  • Last Updated : 27 Feb, 2023
Improve Article
Save Article
Like Article

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.


wx.ToolBar.SetMargins(self, x, y)


ParameterInput TypeDescription
xintLeft margin, right margin and inter-tool separation value.
yintTop margin, bottom margin and inter-tool separation value.

Return Type:


Code Example 1: 


import wx
class Example(wx.Frame):
    def __init__(self, *args, **kwargs):
        super(Example, self).__init__(*args, **kwargs)
    def InitUI(self):
        self.locale = wx.Locale(wx.LANGUAGE_ENGLISH)
        self.toolbar = self.CreateToolBar()
        self.toolbar.SetMargins(20, 10)
        td = self.toolbar.AddTool(1, 'right', wx.Bitmap('right.png'))
        self.SetSize((350, 250))
        self.SetTitle('Undo redo')
    def OnQuit(self, e):
def main():
    app = wx.App()
    ex = Example(None)
if __name__ == '__main__':


(20, 10)

My Personal Notes arrow_drop_up
Like Article
Save Article
Related Articles

Start Your Coding Journey Now!