>>>>> "wanwan" <[EMAIL PROTECTED]> (w) wrote:
>w> I'm trying to make a GUI, but for some of the instantiated object >w> variable names, the interpreter is looking at them as global names. >w> Here is an example of what I did: >w> class mygui: >w> def __init__(self, root): >w> self.menubar = Menu(root) >w> # Game Menu >w> self.menu1 = Menu(self.menubar, tearoff=0) >w> self.menu1.add_command(label="Open File", command=donothing) >w> self.menu1.add_separator() >w> self.menu1.add_command(label="Exit", command=root.quit) >w> self.menubar.add_cascade(label="File", menu=self.menu1) >w> # ignoring the rest of the program ... >w> when I run my example, an error shows: >w> "NameError: global name'menubar' is not defined" If it talks about global name, it can't be self.menubar or anything.menubar. So there must be a soloist menubar reference somewhere. Doesn't it tell you the line number? -- Piet van Oostrum <[EMAIL PROTECTED]> URL: http://www.cs.uu.nl/~piet [PGP 8DAE142BE17999C4] Private email: [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list