On 8/9/2019 3:40 AM, Ahmad Adam Kabbara wrote:

      when I write**from
      tkinter import*

Please put statements on one line.

    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

Please reread the sections of the tutorial and reference that explain imports and their effect on the names available in the *importing* module.

      I also tried another way**
      from tkinter.colorchooser import*
      colorchooser.askcolor()
      and I also got an error message
      Traceback (most recent call last):
      ** File "<pyshell#1>", line 1, in <module>
      ****** colorchooser.askcolor()
      NameError: name 'colorchooser' is not defined

Same issue, which has nothing to do with tkinter as such. The title should be 'Help with imports'.

      the only time it worked is when I typed**
      from tkinter import colorchooser
      colorchooser.askcolor()

When you import the name 'colorchooser', it is defined and usable. When you do not, it is not. Keep doing experiments until you see the pattern and principle. Learning experiments are really easy with python.

--
Terry Jan Reedy

--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to