wxPython - GetBackgroundColour() function in wx.MenuBar Last Updated : 04 Jun, 2020 Summarize Comments Improve Suggest changes Share Like Article Like Report 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.GetBackgroundColour(self) Parameters: No parameters are required in GetBackgroundColour() function Return Type: wx.Colour Code Example 1: Python3 1== 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.menubar = wx.MenuBar() self.fileMenu = wx.Menu() self.item = wx.MenuItem(self.fileMenu, 1, '&Check') self.fileMenu.Append(self.item) # print the background colour of menu item print(self.item.GetBackgroundColour()) self.menubar.Append(self.fileMenu, '&File') self.SetMenuBar(self.menubar) self.SetSize((350, 250)) self.SetTitle('Icons and shortcuts') self.Centre() def main(): app = wx.App() ex = Example(None) ex.Show() app.MainLoop() if __name__ == '__main__': main() Output: (-1, -1, -1, 255) Code Example 2: Python3 1== 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.menubar = wx.MenuBar() self.fileMenu = wx.Menu() self.item = wx.MenuItem(self.fileMenu, 1, '&Check') self.item.SetBackgroundColour((225, 200, 100, 255)) self.fileMenu.Append(self.item) # print the background colour of menu item print(self.item.GetBackgroundColour()) self.menubar.Append(self.fileMenu, '&File') self.SetMenuBar(self.menubar) self.SetSize((350, 250)) self.SetTitle('Icons and shortcuts') self.Centre() def main(): app = wx.App() ex = Example(None) ex.Show() app.MainLoop() if __name__ == '__main__': main() Output: (225, 200, 100, 255) Comment More infoAdvertise with us Next Article wxPython - GetMenuCount() function in wx.MenuBar R RahulSabharwal Follow Improve Article Tags : Python Python-gui Python-wxPython Practice Tags : python Similar Reads 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.StatusBar 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, co 1 min read wxPython - GetMenuCount() function in wx.MenuBar GetMenuCount() function is another function present in wx.MenuBar class of wxPython. GetMenuCount() function return total number of menus present in MenuBar. It takes no arguments. Syntax: wx.MenuBar.GetMenuCount(self) Parameters : No parameters in GetMenuItem() Return : Returns the number of menus 1 min read wxPython - GetMenus() function in wx.MenuBar In this article we are going to learn about GetMenus() function associated with wx.MenuBar class of wxPython. GetMenus() function simply returns a list of (menu, label) items for the menus in the MenuBar. No arguments are required in GetMenus() function. Syntax: wx.MenuBar.GetMenus(self) Parameters: 1 min read wxPython - GetLabel() function in wx.MenuBar GetLabel() is another function present in wx.MenuBar class of wxPython. GetLabel() function is used to return the label of menu inside menu present in menubar. GetLabel() function only takes id as an argument and returns string Label of menu item. Syntax : wx.MenuBar.GetLabel(self, id) Parameters : 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 Like