[Tutor] Why can't I import this?

Dick Moores rdm at rcblue.com
Wed Nov 29 00:45:14 CET 2006


I just discovered something for Tkinter that I want to use. It's a 
Tooltip class, at <http://tkinter.unpythonic.net/wiki/ToolTip> .

I've copied it to a file I named toolTipDemo.py and put it with a 
couple of other files I use as modules. They're in
E:\Python25\Lib\site-packages\mine. One file there is intSpell.py, 
and I can import it by

from mine.intSpell import intSpell

With no problem:
 >>> from mine.intSpell import intSpell
 >>>
However, the same method of importing doesn't work with toolTipDemo:
 >>> from mine.toolTipDemo import toolTipDemo
Traceback (most recent call last):
   File "<string>", line 1, in <string>
ImportError: cannot import name toolTipDemo

I've tried various things, such as remarking out the whole demo at 
the bottom, but leaving

if __name__ == '__main__':
     #demo()
     pass

Any ideas on what I've done wrong?

BTW, toolTipDemo.py runs fine at the command line. I.e., the demo 
shows up nicely, with 2 tooltips.

Thanks,

Dick Moores



More information about the Tutor mailing list