newbie: callback functions

Rainer Deyke root at rainerdeyke.com
Tue Apr 17 13:45:26 EDT 2001


<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'))



--
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