Importing a whole package works in IDLE, but not in shell. The following works fine in IDLE:
import tkinter as tk
tk.filedialog.askopenfilename()
In shell, I get this error:
AttributeError: 'module' object has no attribute 'filedialog'
I understand that I have to import tkinter.filedialog
to make this work in shell.
Why the difference between IDLE and shell? How can I make IDLE act like shell? It can be frustrating to have a script working in IDLE, and failing in shell.
I am using Python 3.4.
tkinter
ortk
in IDLE, it saysname 'tkinter' is not defined
orname 'tk' is not defined
, which it should be defined if the explanation in that other post is correct. – Sure