[Tutor] I'm just full of questions today

wheelege wheelege@tsn.cc
Sun, 29 Oct 2000 17:23:15 +1100


  That isn't the first time I have seen the lambda thing but I am still
confused about it.
  I did have a look at the way to change the title of a Toplevel widget
(window), and that is how it says to do it.  I'll think about that later
though :)
  Okay, so this line:

b = Button(root, text='hi', command=
                  lambda name="wheelege": hi(name))

  Says, make a button, call it b, have the parent 'root', the text 'hi', and
it's command is to call the function hi with the argument of 'wheelege'?
  Hmm....problem is, I'm trying to get about 50 arguments in there.  Well,
not 50 but close to it.  Isn't there a way to say, eg

x = int(global) ## not the right syntax, sure, but you know what I'm trying
to say
x = 7

  And x would be global?  Or isn't that applicable with Tkinter?  I had an
experiment with the StringVar() and IntVar() commands/methods/tk thingies
but they just ended up confusing me.
  If I could just define everything as global then it would all be good -
and I could reference those variables from anywhere in the script (so to
speak).

  Another way to solve this, is to assign local variables the values of the
vaiables that I want global.  In this case, I am keeping the values of the
x0,y0,x1,y1 coords for a bunch of shapes in a bunch of different lists and
things.  I have all the methods working fine, and everything gels (thus far)
except I cannot change the values of these variables (or get their value)
from inside a function/callback (the same thing?).  SO what I tried
initially was to re-assign the values to local variables, but alas I was
foiled because I could not get them - I was always attacked with a 'variable
does not exist' error.

  Anyway - I could ramble forever,
  Thanks for your help!