Svennglenn wrote:
I have a problem with a program i'm
making in Tkinter.
The code is avaliable at:
http://paste.plone.org/943

When i'm running the program and enters a value and press the
button in the dialog window that comes up when a press the
button "Lägg till spelare" (add a player in swedish)
I get this error message:
NameError: global name 'entry' is not defined



Does anyone know what the problem is?

You define entry in the local namespace of laggtillspare() and then try to reference it from bekraftspelare(), where it is neither local nor global.

That's why most Tkinter-based designs define a class for each window. The instance's namespace can then be used by all methods as a shared namespace. Instead of entry you would refer to self.entry in two methods of the same instance.

If you don't know what I'm talking about, take a look at some simple Tkinter examples. It should start to make sense after you've pored over the code for an house or so ...

regards
 Steve
--
Meet the Python developers and your c.l.py favorites March 23-25
Come to PyCon DC 2005                      http://www.pycon.org/
Steve Holden                           http://www.holdenweb.com/
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to