Skip to content
Related Articles
Get the best out of our app
GeeksforGeeks App
Open App

Related Articles

wxPython | GetClassDefaultAttributes() function in python

Improve Article
Save Article
Like Article
Improve Article
Save Article
Like Article

In this article we are going to learn about GetClassDefaultAttributes() of class wx.ToolBar of wxPython. GetClassDefaultAttributes() is used to return visual attributes of toolbar like background color, foreground color, the font used for control label/text inside it. Parameters :

ParameterInput TypeDescription
variantwindowVariantVariant style of window

Syntax :


Return Type:


Code Example: 


import wx
class Example(wx.Frame):
    global count
    count = 0;
    def __init__(self, *args, **kwargs):
        super(Example, self).__init__(*args, **kwargs)
    def InitUI(self):
        self.locale = wx.Locale(wx.LANGUAGE_ENGLISH)
        pnl = wx.Panel(self)
        self.toolbar = self.CreateToolBar()
        # Add Tools Using AddTool function
        rtool = self.toolbar.AddTool(13, 'twoTool', wx.Bitmap('wrong.png'), shortHelp ="Simple Tool2")
        self.SetSize((350, 250))
        # get Visual attribute object
        t = self.toolbar.GetClassDefaultAttributes(variant = wx.WINDOW_VARIANT_NORMAL)
        # print background color ratio
        # print foreground color ratio
        # print wx.Font object
def main():
    app = wx.App()
    ex = Example(None)
if __name__ == '__main__':


(240, 240, 240, 255)
(0, 0, 0, 255)
<wx._core.Font object at 0x00000080FC7B5280>

My Personal Notes arrow_drop_up
Last Updated : 03 Mar, 2023
Like Article
Save Article
Similar Reads
Related Tutorials