CookieSY999
CookieSY999

Reputation: 3

Tkinter: Color Chooser on MacOS

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?

Upvotes: 0

Views: 280

Answers (2)

QuantumX
QuantumX

Reputation: 172

import as:

from tkinter.colorchooser import askcolor

and you can direct use,

askcolor(color=None, **options)

Upvotes: 3

Shiv
Shiv

Reputation: 348

Some modules reqiure you to do from tkinter import x, and do not get imported with from tkinter import *. Add from tkinter import colorchooser into your code.

Upvotes: 1

Related Questions