Op 23-04-12 12:44, Pierre Barthelemy schreef:
Hi everyone,
I am new to this mailing list. I am working on a program to perform
data analysis in python. This program is based on a library already
developped, that uses pygtk to create data-handling objects.
This data object inherits from gobject.GObject, and defines a few
signals "new-data-point".
I would like to connect this signal to a few functions, specifying the
arguments of these functions. I have read the PyGTK webpage
(http://www.pygtk.org/docs/pygobject/class-gobject.html#method-gobject--connect),
which specifies that i just have to concatenate in the "connect" call
the arguments: "object.connect("signal_name",handler,arg1,arg2,arg3)
I therefore have written:
data.connect("new-data-point", handler,'text')
and defined the handler function as suggested: def
handler(object,arg1,arg2,arg3)
def handler(data,argument):
print data
print argument
However, when i do execute the "connect" function, i get the error
message:
"connect takes exactly 3 arguments (4 given).
It could be a couple of things, but the easiest way to find out is (and
this applies to all Python functions in the future when you encounter
this exception):
def handler(*args):
print args
And see for yourself which arguments are passed.
If the error is in the data.connect() call, try with only one argument
and see if it passes, then two, then ...
Without code, it's impossible for us to say what it expects.
Cheers,
Timo
Could you tell me how i could then specify arguments for the functions
to be called when the signal is given ?
Bests,
Pierre
_______________________________________________
pygtk mailing list pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/
_______________________________________________
pygtk mailing list pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/