Search code examples
pythoncolorspixel

python visualize 1 RGB pixel


I have a RGB color with the following specifications: R = 62, B = 120, G = 70

Is there a way in Python to generate one pixel of this specific RGB color in order to be able to see what the color looks like ?


Solution

  • One pixel doesn't seem like it would be visible enough. How about a small window full of the color?

    color = (62, 70, 120)
    from Tkinter import Tk    # lower case T if you're using Python 3.x
    root = Tk()
    root['bg'] = "#%02x%02x%02x" % color
    root.mainloop()