newbie: callback functions

koenig at v-i-t.de koenig at v-i-t.de
Tue Apr 17 15:42:20 EDT 2001


In article <Wi%C6.37388$J%5.12316267 at news2.rdc2.tx.home.com>, "Rainer Deyke" <root at rainerdeyke.com> wrote:
> <koenig at v-i-t.de> wrote in message
> news:9bhs59$kej$1 at sun27.hrz.tu-darmstadt.de...
>> hi
>>
>> in tkinter:
>> why can callback functions onlx have one parameter?
>> when i press a button, i want that a function is executed with many
> parameters,
>> so that i can pass the function a filename or something to work with that.
>>
>> how can i do such things?
> 
> Tuples are your friends.
> 
> def f(args):
>   a, b = args
>   print 'Received args %s and %s.' % (a, b)
> 
> def call_f(arg):
>   f(arg)
> 
> call_f(('Hello', 'spam'))
> 
> 
i meant something like this
 Button( dlgframe, text="OK", relief=GROOVE, command=load )

i want to pass "load" pass a eg. filename, so that "load" knows what to load.
how is this possible?
> 
> --
> Rainer Deyke (root at rainerdeyke.com)
> Shareware computer games           -           http://rainerdeyke.com
> "In ihren Reihen zu stehen heisst unter Feinden zu kaempfen" - Abigor
> 
> 





More information about the Python-list mailing list