On 8/9/19 4:52 AM, Peter J. Holzer wrote: > 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 better thing to do is remove the import * line and just "import tkinter" and then make sure all your calls to tkinter objects are fully qualified with the "tkinter." part like you've already been doing. -- https://mail.python.org/mailman/listinfo/python-list