Tkinter Query

Chad Netzer cnetzer at mail.arc.nasa.gov
Wed Oct 9 21:08:52 EDT 2002


On Wednesday 09 October 2002 15:05, Newt wrote:
> Hi,
>
> I'm trying to build a form with some rows. 

[snipped]

> In the code above, I'm trying to use svals to hold the values of sval as
> they are created.
>
> When I run this, I get an error that svals is not a global. So two
> questions:
> 1. How do I make svals into a global?

  You don't.  See below

> 2. What is the correct way to implement what I'm trying to do?

I haven't looked at what the code is trying to do, just a cursory scan to fix 
#1 for you.  

You want to make sval a part of the object state (ie.  It stays with the 
object, and can be used in other member functions).  To do this, you refer to 
it as self.svals, not just svals.  The first adds it as a member of the 
object, the second declares it a local variable, which goes away when the 
member function returns.

So, as a first step, change all the svals to self.svals.

Then, since pos doesn't exist in the down() member function, change that too. 
 I think you meant to use 'i'.  In any case, the self.svals thing will get 
you started.

-- 

Chad Netzer
cnetzer at mail.arc.nasa.gov




More information about the Python-list mailing list