[Tutor] Global name not found, though clearly in use

2010-07-14 Thread Corey Richardson
Hey tutors. Two separate submissions one day, guess I'm getting busy ;) Anyway, I'm re-writing my hangman program to make use of my new-found understanding of OOP, and using a GUI this time around. I decided on coding with Tkinter, to get my feet wet with GUI stuff. Here is the traceback:

Re: [Tutor] Global name not found, though clearly in use

2010-07-14 Thread Nitin Pawar
From the logs looks like the variable is not initiated when it was used. If I read it correct, you said it down ... that means below the line where the error came? and if they belong to same function then this error is valid Thanks, Nitin On Wed, Jul 14, 2010 at 7:48 PM, Corey Richardson

Re: [Tutor] Global name not found, though clearly in use

2010-07-14 Thread Steven D'Aprano
On Thu, 15 Jul 2010 12:18:58 am Corey Richardson wrote: Hey tutors. Two separate submissions one day, guess I'm getting busy ;) Anyway, I'm re-writing my hangman program to make use of my new-found understanding of OOP, and using a GUI this time around. I decided on coding with Tkinter, to

Re: [Tutor] Global name not found, though clearly in use

2010-07-14 Thread Corey Richardson
I was under the impression that when you define a function, it doesn't try to evaluate anything yet. If I had called the function before I defined the variable, I would understand, but I haven't. The entirety of my (incomplete and buggy) code is now available here:

Re: [Tutor] Global name not found, though clearly in use

2010-07-14 Thread Emile van Sebille
On 7/14/2010 8:31 AM Corey Richardson said... I was under the impression that when you define a function, it doesn't try to evaluate anything yet. If I had called the function before I defined the variable, I would understand, but I haven't. The difference is in understanding what's executed

Re: [Tutor] Global name not found, though clearly in use

2010-07-14 Thread Corey Richardson
Hmm..If I add a few debugging lines like that into my code, I get this: Starting program In class Hangman done defs in class eWordEntryBox defined Exception in Tkinter callback Traceback (most recent call last): File "C:\Python31\lib\tkinter\__init__.py", line 1399, in __call__

Re: [Tutor] Global name not found, though clearly in use

2010-07-14 Thread Dave Angel
Corey Richardson wrote: The entirety of my (incomplete and buggy) code is now available here: http://pastebin.com/QTNmKYC6 .. Hmm..If I add a few debugging lines like that into my code, I get this: Starting program In class Hangman done defs in class eWordEntryBox defined Exception in

Re: [Tutor] Global name not found, though clearly in use

2010-07-14 Thread Alan Gauld
Corey Richardson kb1...@aim.com wrote defined the variable, I would understand, but I haven't. The entirety of my (incomplete and buggy) code is now available here: http://pastebin.com/QTNmKYC6 There are quite a few errors here, one is that many of your class's methods don't have self as

Re: [Tutor] Global name not found, though clearly in use

2010-07-14 Thread Emile van Sebille
On 7/14/2010 9:33 AM Corey Richardson said... Hmm..If I add a few debugging lines like that into my code, I get this: The point was that statements in a class at class level (ie, not in defs) are executed sequentially and expect referenced variables to exist (ie, defined somewhere 'above'

Re: [Tutor] Global name not found, though clearly in use

2010-07-14 Thread Serdar Tumgoren
Hmm..If I add a few debugging lines like that into my code, I get this: The point was that statements in a class at class level (ie, not in defs) are executed sequentially and expect referenced variables to exist (ie, defined somewhere 'above' the current statement) -- there is no forward

Re: [Tutor] Global name not found, though clearly in use

2010-07-14 Thread Emile van Sebille
On 7/14/2010 11:11 AM Serdar Tumgoren said... But I was wondering (for my own edification), can anyone point to the portion of the docs that clearly spells out the order of execution (top to bottom, classes vs. functions, etc.). I found this in the tutorial in the modules section: ( see

Re: [Tutor] Global name not found, though clearly in use

2010-07-14 Thread Serdar Tumgoren
I also found this interesting (but possibly not to newbies :) : http://www.shinetech.com/attachments/108_python-language-internals.pdf Very helpful, especially that last resource. Thank you! Serdar ___ Tutor maillist - Tutor@python.org To