wxPython - Get Default Attributes of StaticText Last Updated : 21 Sep, 2021 Summarize Comments Improve Suggest changes Share Like Article Like Report In this article, we are going to learn how can we get different attributes of StaticText like background, foreground colors, and fonts. We use GetClassDefaultAttributes() function to get an object of wx.VisualAttributes. It may or may not take variant as an argument. Syntax: wx.StaticText.GetClassDefaultAttributes() or wx.StaticText.GetClassDefaultAttributes(variant=WINDOW_VARIANT_NORMAL) Parameters: ParameterInput TypeDescriptionvariantWindowVariantvariant for static text. Return Type: wx.VisualAttributes Code Example: 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) self.pnl = wx.Panel(self) bmp = wx.Bitmap('right.png') # CREATE STATICTEXT AT POINT (20, 20) self.st = wx.StaticText(self.pnl, id = 1, label ="This is the Label.", pos =(20, 20), size = wx.DefaultSize, style = wx.ST_ELLIPSIZE_MIDDLE, name ="statictext") self.st.SetBackgroundColour((255, 252, 92, 255)) self.st.SetForegroundColour((14, 96, 150, 255)) # GET DEFAULT ATTRIBUTES OBJECT v = self.st.GetClassDefaultAttributes(); print(v.colBg) print(v.colFg) print(v.font) self.SetSize((350, 250)) self.SetTitle('wx.Button') self.Centre() def main(): app = wx.App() ex = Example(None) ex.Show() app.MainLoop() if __name__ == '__main__': main() Console Output: (240, 240, 240, 255) (0, 0, 0, 255) Output Window: Comment More infoAdvertise with us Next Article wxPython - Change Cursor image on StaticText R RahulSabharwal Follow Improve Article Tags : Python Python-gui Python-wxPython Python wxPython-StaticText Practice Tags : python Similar Reads wxPython - Get visual attributes of static box In this article we are going to learn how can we get wx.VisualAttributes associated with Static Box. In order to do that we will use static GetClassDefaultAttributes() function. GetClassDefaultAttributes() function is used to return wx.VisualAttributes object for properties like background colour, f 1 min read wxPython - Change Font of StaticText In this article we are going to learn how can we change the font of static text present on the window. To do this first of all, we will create a wx.Font class of wxPython. After this we will use SetFont() function of wx.StaticText class. SetFont() function takes a sing wx.Font type parameter. Syntax 1 min read wxPython - Change Cursor image on StaticText In this article we will learn how can we change cursor image when cursor hovers over the static text. We can do it by creating a cursor object and using SetCursor() function associated with wx.StaticText class of wxPython. SetCursor() takes wx.Cursor object as a parameter. Syntax: wx.StaticText.SetC 1 min read wxPython - Create() function in wx.StaticText In this article we are going to learn about Create() associated with wx.StaticText class of wxPython. A static text control displays one or more lines of read-only text. Create() function is used for two step creation of static text. It takes attributes of statictext as arguments. Syntax: wx.StaticT 1 min read wxPython - CaptureMouse() in wx.StaticText Python provides wxpython package which allows us to create high functional graphical user interface. It is 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 w 2 min read wxPython - GetDefaultSize() method in wx.StaticLine In this article we are going to learn about method GetDefaultSize() associated with wx.StaticLine class of wxPython. GetDefaultSize() method is simply used to return the size which will be given to the smaller dimension of the static line, i.e. Its height for a horizontal line or its width for a ver 1 min read Like