"Gabriel B." <[EMAIL PROTECTED]> writes:
> i have the following code:
>
> Ui.py:
> import Tkinter as Tk
> import UiMainScreen
>
> UiMainScreen.py:
> class UiMainScreen( Tk.Frame ):
> ....
>
> and i get the following error:
> File "UiMainScreen.py", line 1, in ?
> class UiMainScreen(Tk.Frame):
> NameError: name 'Tk' is not defined
>
> isn't Tk supposed to be imported globaly?
No. import only affects thye module it's in. You need to add "import
Tk" to UiMainScreen.py.
> And If i import Tkinter again inside every other file, will it be
> really imported several times and be independent in each file or the
> python interpreter just use the subsequent imports to know where to
> propagate stuff?
The module is only imported once. The second and further imports link
the name Tk in the importing module to the Tk module already imported.
<mike
--
Mike Meyer <[EMAIL PROTECTED]> http://www.mired.org/home/mwm/
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.
--
http://mail.python.org/mailman/listinfo/python-list