On Friday 17 November 2006 02:58, you wrote:
> On Fri, 17 Nov 2006 00:25:39 -0500,
> jim-on-linux <[EMAIL PROTECTED]>
>
> declaimed the following in comp.lang.python:
> > Without being able to run the code my
> > question is where is the  id  in the lambda
> > defined?
>
>       Please take into account that I've not
> actually used lambdas, so might have some
> mistakes in the syntax...
>
> > >     for bill in shelvename:
> > >         global funcs
> > >         bill1 = Button(None, text=
> > > shelvename[bill].name,
> > > font=('bold',10),command=(lambda x = id:
> > > fetchRecord(x)))
>
>       "id" would be something that "identifies" the
> button... In this case, maybe you can use
> "bill":
>

Think about relating a Tkinter variable to each 
button then the button is related to a unique 
variable. ( Tkinter StingVar or IntVar or some 
others.) Then you will have to keep the variables 
in a list or dictionary for recalling. 


jim-on-linux
http://www.inqvista.com





>       ... command=(lambda x = bill: fetchRecord(x))
> ...
>
> As I understand the lambda syntax, what this
> does is create a "function" (which is the
> command that gets run when the button is
> pushed), and this function will call
> fetchRecord passing it the value that "x" had
> at the time of definition (hence the x=...)
> --
>       Wulfraed        Dennis Lee Bieber               KD6MOG
>       [EMAIL PROTECTED]               [EMAIL PROTECTED]
>               HTTP://wlfraed.home.netcom.com/
>       (Bestiaria Support
> Staff:                [EMAIL PROTECTED])
> HTTP://www.bestiaria.com/
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to