Skip to content
Related Articles

Related Articles

Improve Article

wxPython – SetBackgroundColour() function in wx.StatusBar

  • Last Updated : 15 Jun, 2020

In this article e are going to learn about SetBackgroundColour() function associated with wx.StatusBar class of wxPython. SetBackgroundColour() function is used to set the colour of the background of the status bar. It takes wx.Colour as an argument.

Syntax: wx.StatusBar.SetBackgroundColour(self, colour)

Parameters:

ParameterInput TypeDescription
colourwx.ColourColour for the background.

Code Example:




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.statusbar = wx.StatusBar(self, id = 1
              style = wx.STB_DEFAULT_STYLE, name ="sb")
        self.statusbar.SetStatusText("This is StatusBar")
        self.statusbar.SetBackgroundColour((80, 60, 170, 230))
  
        self.SetStatusBar(self.statusbar)
  
def main():
    app = wx.App()
    ex = Example(None)
    ex.Show()
    app.MainLoop()
  
  
if __name__ == '__main__':
    main()

Output Window:

 Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.  

To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course. And to begin with your Machine Learning Journey, join the Machine Learning – Basic Level Course




My Personal Notes arrow_drop_up
Recommended Articles
Page :