passing arguments from scale widget to function
m7b52000
tpearce at internode.on.net
Mon Aug 22 07:16:01 EDT 2005
Matt Hammond wrote:
> On Sun, 21 Aug 2005 08:09:55 +0100, m7b52000
> <oh_no_you_don't at noSPAM.com> wrote:
>
>> It is proving most difficult in Python. How do I pass the .get()
>> values to my calculating function? Do I use the command option for
>> each slider? e.g command = Calc(a.get()). Obviously not cos it
>> doesn't work.
>
>
> It should work if you wrap it as a lambda function. As it is, you're
> assigning the
> result of the Calc() function to the 'command' argument/parameter of
> the slider widget. What you actually want is to assign just the function:
>
> command = lambda : Calc(a.get())
>
>> I am not a real programmer and do not wish to get involved in classes
>> and objects....
>
>
> If you're using Tcl/Tk you're already using them ... what do you think
> your Slider widget is? :-)
>
> Hope this helps!
>
> regards
>
>
> Matt
Thanks,
I get the following message when I use lambda as above:
TypeError: <lambda>() takes no arguments (1 given)
any other thoughts :)
Tony
More information about the Python-list
mailing list