wxPython - Change Font of StaticText Last Updated : 10 Sep, 2022 Summarize Comments Improve Suggest changes Share Like Article Like Report 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: wx.StaticText.SetFont(self, font) Parameters: ParameterInput TypeDescriptionfontwx.FontFont for the static text. 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) # create wx.Font object font = wx.Font(20, family = wx.FONTFAMILY_MODERN, style = 0, weight = 90, underline = False, faceName ="", encoding = wx.FONTENCODING_DEFAULT) 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") # set font for the statictext self.st.SetFont(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() Output Window: Comment More infoAdvertise with us Next Article wxPython - Change font of Radio Button R RahulSabharwal Follow Improve Article Tags : Python Python-gui Python-wxPython Python wxPython-StaticText Practice Tags : python Similar Reads 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 - Change font of Radio Button In this article we are going to learn that how can we change the font of the label text present on the radio button present in the frame. We need to follow some steps as follows: Step 1: Create a wx.Font object. Step 2: Add different attributes of font in parameters like: family, style etc. Step 3: 1 min read wxPython - Change font for text present in Radio Box In this article we are going to learn how can we change the font of textpresent inside the Radio box. In order to do this we will follow 3 steps: Step 1: Create a wx.Font object variable named f. Step 2: Create a Radio box. Step 3: Set f as font for Radio box using SetFont() method. Syntax: wx.Radio 2 min read wxPython - Change font colour of RadioBox In this article we are going to learn how can we change the foreground colour of Radio Box present in the frame. In order to do that we are going to use SetForegroundColour() method. SetForegroundColour() function takes wx.Colour argument which will be used as foreground colour for Radio Box. Syntax 1 min read wxPython - Get Default Attributes of StaticText 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.GetClassDe 1 min read Like