Python provides wxpython package which allows us to create a highly functional graphical user interface. It is implemented as a set of extension modules that wrap the GUI components of the wxWidgets library which is written in C++. It is a cross-platform GUI toolkit for python, Phoenix version Phoenix is the improved next-generation wxPython and it mainly focused on speed, maintainability, and extensibility.
In this article, we are going to learn about GetClassDefaultAttributes() function associated with wx.RadioButton class of wxPython. GetClassDefaultAttributes() function is used to return wx.VisualAttributes object for properties like background color, foreground color, and font associated with the Radio button.
 
Syntax: wx.RadioButton.GetClassDefaultAttributes(variant=WINDOW_VARIANT_NORMAL)
Parameters:
Parameter Input Type Description variant WindowVariant Variant for Radio Button. Return Type: wx.VisualAttributes
Code : 
 
Python3
| # importing wx library importwx  APP_EXIT =1 # create an Example class classExample(wx.Frame):     # constructor     def__init__(self, *args, **kwargs):         super(Example, self).__init__(*args, **kwargs)          # method calling         self.InitUI()          # method for user interface creation     defInitUI(self):          # create parent panel for radio buttons         self.pnl =wx.Panel(self)           # create radio button          self.rb =wx.RadioButton()         self.rb.Create(self.pnl, id=1,                        label ="Radio",                        pos =(20,20))          # set background colour to blue         self.rb.SetBackgroundColour((0, 0,                                       255, 255))         # set foreground colour to white         self.rb.SetForegroundColour((255, 255,                                      255, 255))          # create wx.VisualAttributes object         v =self.rb.GetClassDefaultAttributes()          # print background colour         print(v.colBg)         # print foreground colour         print(v.colFg)  # main function defmain():   # create an App object   app =wx.App()      # create an Example object   ex =Example(None)   ex.Show()      # running an app   app.MainLoop()  # Driver code if__name__ =='__main__':      # main function call   main()  | 
Output:
(0,0,255,255, 255) (255, 255, 255, 255)

 
                                    







