At 07:48 PM 11/28/2006, Kent Johnson wrote:
>Dick Moores wrote:
> > At 07:20 PM 11/28/2006, Kent Johnson wrote:
> >> Try
> >>from mine.toolTipDemo import demo
> >> mine.toolTipDemo points to the module, then you need to reference a name
> >> defined in the module. (You must have something called intSpell in
> >> intSpell.py.)
> >
> > Interestingly (or not) it just hit me that I should try that, and it
> > worked. So I suppose that if I want to use tooltips in a Tkinter
> > program, I can just use  "from mine.toolTipDemo import *" and use
> > what I need. (Haven't tried that yet, however.)
>
>Yes, you can do that but in general that style is not recommended. It
>makes it hard to figure out where names are defined and you can import
>more than you really want. Better is to just import what you want, e.g.
>from mine.toolTipDemo import A, b, CC

Thanks, Kent. Turns out all I needed was the class, ToolTip. So just

from mine.toolTipDemo import ToolTip

will do it.

>or import the module with an alias:
>import mine.toolTipDemo as TTD
>
>then refer to e.g.
>TTD.demo()

A good trick.

Thanks very much, Kent.

Dick



_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to