[Tutor] python connect() function

Pierre Barthelemy barthpi at gmail.com
Wed Apr 11 15:49:10 CEST 2012


Hello,

I have a question about event handling and the use of the connect function.
I have a data object, that contains a series of signals, one being
"new_data_point" .

When i want to plot the data, i also connect the "new_data_point" event to
the function "analysis_client.update_plot". I therefore run the line:

data.connect('new_data_point', analysis_client.update_plot)

In this case, everytime the data object is updated, i also update the plot.


I would like to adapt this code to allow to have several plots, connected
to several data objects. I would therefore need to specify, when i connect
the "update_plot" function, which plots needs to be updated.
Is it possible to specify arguments to be used by the connected function
when the event occurs ? For instance, is there a way to write something
like:

data.connect('new_data_point',
analysis_client.update_plot(specific_plot_instance))

So that when the event occurs, the corresponding plot (and only this one)
is updated ?

Pierre
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20120411/d50185fe/attachment.html>


More information about the Tutor mailing list