Some objects missing from tkinter

Shane shane at hatagawa.com
Mon Apr 26 19:25:19 CEST 2010


I'm new to Python, so I'll try to be clear about my problem.

I'm using Python 3.1 (latest stable version from python.org) on
Windows 7.
I have a program using tkinter for UI, and it works properly from both
pything GUI shell, and running from command prompt, EXCEPT that I have
a menu command to invoke tkinter.filedialog.askopenfile, and it fails
because it says:

file = tkinter.filedialog.askopenfilename()
AttributeError: 'module' object has no attribute 'filedialog'

I made a simple test program:

import tkinter
print (dir(tkinter))

when I run this from the GUI shell, the results include filedialog,
but from the command prompt, it does not (also missing other
attributes, such as messagebox).

All the UI widgets work properly.
My best hypothesis at this point is that from the GUI shell its using
the source code under lib\tkinter (where there is a filedialog.py),
but from the command shell it is using the compiled dll, and that
doesn't export filedialog for some reason.

Thanks in advance for any suggestions



More information about the Python-list mailing list