Python Tkinter – Color Chooser Example

Hello everyone, In this tutorial, you will learn how to bring color chooser using Tkinter in Python. The example program has been tested and shared in the same post.

Example Program

import tkinter as tk<br>
from tkinter.colorchooser import *

#defining get_color function
def get_color():<br>
    color = askcolor()<br>
    print(color)

#creating an instance for Tk
root = tk.Tk()<br>
root.title("Color Chooser")

btn = tk.Button(text='Select Color', command=get_color)<br>
btn.pack()

#starting an application
root.mainloop()

Output

((160.625, 160.625, 160.625), '#a0a0a0')