Problem with variabels in Tkinter

S

Svennglenn

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?
 
S

Steve Holden

Svennglenn said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,222
Messages
2,571,137
Members
47,754
Latest member
Armand37T7

Latest Threads

Top