[Tutor] Time to Use a Global Variable?
Hugo González Monteverde
hugonz-lists at h-lab.net
Fri Feb 10 05:20:45 CET 2006
Hi Rich
I guess passing a reference to the database handler instance that
contains closeDB to your app's __init__ is less dirty that having a
global variable, what do you think?
Hugo
>
> When I test the application and try to close it, python complains
> File "eikos.py", line 315, in OnFileQuit
> closeDb()
> NameError: global name 'closeDb' is not defined
>
> I've tried changing OnFileQuit to call DBinterface.closeDB(), but that
> doesn't work. Obviously I still haven't completely grokked how to refer in
> one class to a method defined in another class. Of course, I've not
> explicitly created an instance of DBinterface within MyFrame, so that may be
> the problem.
>
> A clue stick is welcome.
>
> Rich
>
More information about the Tutor
mailing list