Friday, September 5, 2025
HomeLanguageswx.ColourDisplay() function in wxPython

wx.ColourDisplay() function in wxPython

In this article we are going to learn about ColourDisplay() method in wxPython. ColourDisplay() function is an inbuilt function present in wxPython. code>ColourDisplay() function is simply used to determine whether the display we are using is colour display or not. ColourDisplay() function returns True if the display is colour, False otherwise.
 

Syntax: 
wx.ColourDisplay()
Parameters: 
ColourDisplay() function requires no arguments.
Return Type: 
bool
 

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):
 
        # condition for colour display
        if(wx.ColourDisplay()==True):
 
            # print if display is Colour display
            print("Display is Colour Display")
 
        else:
 
            # print if display is not Colour display
            print("Display is not Colour Display")
                 
# 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()


Output: 
 

Display is Colour Display

 

Dominic
Dominichttp://wardslaus.com
infosec,malicious & dos attacks generator, boot rom exploit philanthropist , wild hacker , game developer,
RELATED ARTICLES

Most Popular

Dominic
32264 POSTS0 COMMENTS
Milvus
81 POSTS0 COMMENTS
Nango Kala
6634 POSTS0 COMMENTS
Nicole Veronica
11801 POSTS0 COMMENTS
Nokonwaba Nkukhwana
11861 POSTS0 COMMENTS
Shaida Kate Naidoo
6750 POSTS0 COMMENTS
Ted Musemwa
7025 POSTS0 COMMENTS
Thapelo Manthata
6698 POSTS0 COMMENTS
Umr Jansen
6718 POSTS0 COMMENTS