The Python Tkinter color chooser does not work in Python Version 3.8.5 on Mac.
Whenever I type in colorchooser.askcolor()
, It always outputs Traceback (most recent call last): File "<pyshell#5>", line 1, in <module> colorchooser.askcolor() NameError: name 'colorchooser' is not defined
.
I did this all in the shell and I didn’t forget to add from tkinter import *
. Could you please help me?
Advertisement
Answer
import
as:
JavaScript
x
2
1
from tkinter.colorchooser import askcolor
2
and you can direct use,
JavaScript
1
2
1
askcolor(color=None, **options)
2