Skip to content
Related Articles

Related Articles

Improve Article
Save Article
Like Article

wxPython – GetClassDefaultAttributes() function in wx.Button

  • Last Updated : 01 Sep, 2021

In this article we are going to learn about GetClassDefaultAttributes() function associated with wx.Button class of wxPython. GetClassDefaultAttributes() function is used to return wx.VisualAttributes object for properties like background colour, foreground colour and font.
It takes variant as argument arguments.

Syntax: wx.Button.GetClassDefaultAttributes(variant=WINDOW_VARIANT_NORMAL)

ParameterInput TypeDescription
variantWindowVariantVariant for button.

Return Type: wx.VisualAttributes

Code Example: 


import wx
class Example(wx.Frame):
    def __init__(self, *args, **kwargs):
        super(Example, self).__init__(*args, **kwargs)
    def InitUI(self):
        self.pnl = wx.Panel(self)
        self.btn = wx.Button(self.pnl, label ='Button', pos =(20, 20))
        # wx.VisualAttributes OBJECT
        va = self.btn.GetClassDefaultAttributes(variant = wx.WINDOW_VARIANT_NORMAL)
        self.SetSize((350, 250))
def main():
    app = wx.App()
    ex = Example(None)
if __name__ == '__main__':

Console Output: 

(240, 240, 240, 255)
(0, 0, 0, 255)

Output Window: 


My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!