On 2019-08-09 10:34:34 +0300, Ahmad Adam Kabbara wrote: > so when I write from > tkinter import* > t=Tk() > tkinter.colorchooser.askcolor() > I get this error message > Traceback (most recent call last): > File "C:\Users\kabba\Desktop\color and coordinates.py", line 3, in > <module> > tkinter.colorchooser.askcolor() > NameError: name 'tkinter' is not defined
You didn't import 'tkinter', you imported all symbols ('*') from tkinter. So, since you imported colorchooser, you can call colorchooser.askcolor() (not tkinter.colorchooser.askcolor()) > the only time it worked is when I typed > from tkinter import colorchooser > colorchooser.askcolor() Here you imported 'colorchooser' from tkinter. So you can call colorchooser.askcolor(). Same as above, except that you have only imported colorchooser and not the myriad of other symbols that '*' would import. hp -- _ | Peter J. Holzer | we build much bigger, better disasters now |_|_) | | because we have much more sophisticated | | | h...@hjp.at | management tools. __/ | http://www.hjp.at/ | -- Ross Anderson <https://www.edge.org/>
signature.asc
Description: PGP signature
-- https://mail.python.org/mailman/listinfo/python-list