confusion between global names and instantiated object variable names
Alex Martelli
aleax at mail.comcast.net
Fri Oct 14 17:46:35 EDT 2005
wanwan <ericwan78 at yahoo.com> wrote:
...
> when I run my example, an error shows:
> "NameError: global name'menubar' is not defined"
>
> I wonder why it doesn't work. Isn't that the way to define an object
> variable?
The code you posted should not trigger this error. Most likely problem:
you have typed a comma where you meant to type a dot, for example
instead of self.menubar you wrote self,menubar somewhere -- it's a hard
error to spot with certain fonts.
Alex
More information about the Python-list
mailing list