wxPython - GetForegroundColour() function in wx.StaticText Last Updated : 10 Oct, 2022 Summarize Comments Improve Suggest changes Share Like Article Like Report In this article we are going to learn about GetForegroundColour() function associated with wx.StaticText class of wxPython. GetForegroundColour() function returns the colour that is used for font or foreground of StaticText. Colour is in format of (R, G, B, A). No parameters are required in GetForegroundColour() function. Syntax: wx.StaticText.GetForegroundColour(self) Parameters: No parameters are required in GetForegroundColour() function. Return Type: wx.Colour Code Example: Python3 # importing the module import wx # definition of the Example class class Example(wx.Frame): # instantiating the class def __init__(self, *args, **kwargs): super(Example, self).__init__(*args, **kwargs) self.InitUI() # method for creation of user interface def InitUI(self): self.locale = wx.Locale(wx.LANGUAGE_ENGLISH) # create parent panel for button self.pnl = wx.Panel(self) # create button at point (20, 20) self.st = wx.StaticText(self.pnl, id = 1, label ="Button") # change foreground colour of button self.st.SetForegroundColour((10, 20, 255, 255)) # get foreground colour fc = self.st.GetForegroundColour() # print foreground colour print(fc) self.SetSize((350, 250)) self.SetTitle('wx.Button') self.Centre() # definition of the main function def main(): # creating an App object app = wx.App() # creating an Example object ex = Example(None) # showing the Example object ex.Show() # running the App object app.MainLoop() # driver code if __name__ == '__main__': main() Console Output: (10, 20, 255, 255) Output Window: Comment More infoAdvertise with us Next Article wxPython - GetBackgroundColour() function in wx.MenuBar R RahulSabharwal Follow Improve Article Tags : Python Python-wxPython Python wxPython-StaticText Practice Tags : python Similar Reads wxPython - SetForegroundColour() function in wx.StaticText In this article we are going to learn about SetForegroundColour() function associated with wx.StaticText class of wxPython. SetForegroundColour() function is simply used to set foreground colour of a static text to a different colour. It takes wx.Colour argument to set the background colour. Syntax: 1 min read wxPython - GetBackgroundColour() function in wx.StaticText In this article, we are going to learn about GetBackgroundColor() function associated with wx.StaticText class of wxPython. GetBackgroundColor() function returns the colour that is used for background of statictext. Colour is in the format of (R, G, B, A). No parameters are required in GetBackground 1 min read wxPython - SetBackgroundColour() function in wx.StaticText In this article we are going to learn about SetBackgroundColour() function associated with wx.StaticText class of wxPython. SetBackgroundColour() function is simply used to set background of a static text to a different colour. It takes wx.Colour argument to set the background colour. Syntax: wx.Sta 1 min read wxPython - GetLabel() function in wx.StaticText In this article we are going to learn about GetLabel() function associated with wx.StaticText class of wxPython. GetLabel() function is an important function it is used to get the string label associated with wxPython. It returns a string. No parameters are required in GetLabel() function. Syntax: w 1 min read wxPython - GetBackgroundColour() function in wx.MenuBar In this article we are going to learn about GetBackgroundColour() function associated with the wx.MenuBar class of wxPython. As the name suggests GetBackgroundColour() returns the background colour associated with the menu item. GetBackgroundColour() function takes no parameters. Syntax: wx.MenuBar. 1 min read wxPython - GetTextColour() function in wx.MenuItem In this article, we are going to learn about GetTextColour() function associated with wx.MenuItem class of wxPython. GetTextColour() function is used to simply return the text color associated with the menu item. No parameters are required in GetTextColour() function. Syntax: wx.MenuItem.GetTextColo 1 min read Like