Thanks for the fast reply. I went a bit deeper into the code and i found where my problem was. The connect function comes from gobject, and the gobject.connect function accepts extra arguments that are passed to the connected function. So i can solve my problem by: <div>
<br></div><div>data.connect(&#39;new_data_point&#39;, analysis_client.update_plot, specific_arguments) </div><div><br></div><div>Bests,</div><div><br></div><div>Pierre<br><br><div class="gmail_quote">On Thu, Apr 12, 2012 at 9:21 AM, Peter Otten <span dir="ltr">&lt;__<a href="mailto:peter__@web.de">peter__@web.de</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">Pierre Barthelemy wrote:<br>
<br>
&gt; I have a question about event handling and the use of the connect<br>
&gt; function. I have a data object, that contains a series of signals, one<br>
&gt; being &quot;new_data_point&quot; .<br>
&gt;<br>
&gt; When i want to plot the data, i also connect the &quot;new_data_point&quot; event to<br>
&gt; the function &quot;analysis_client.update_plot&quot;. I therefore run the line:<br>
&gt;<br>
&gt; data.connect(&#39;new_data_point&#39;, analysis_client.update_plot)<br>
&gt;<br>
&gt; In this case, everytime the data object is updated, i also update the<br>
&gt; plot.<br>
&gt;<br>
&gt;<br>
&gt; I would like to adapt this code to allow to have several plots, connected<br>
&gt; to several data objects. I would therefore need to specify, when i connect<br>
&gt; the &quot;update_plot&quot; function, which plots needs to be updated.<br>
&gt; Is it possible to specify arguments to be used by the connected function<br>
&gt; when the event occurs ? For instance, is there a way to write something<br>
&gt; like:<br>
&gt;<br>
&gt; data.connect(&#39;new_data_point&#39;,<br>
&gt; analysis_client.update_plot(specific_plot_instance))<br>
&gt;<br>
&gt; So that when the event occurs, the corresponding plot (and only this one)<br>
&gt; is updated ?<br>
<br>
</div></div>Like Walter I have no idea what framework or library you are talking about.<br>
The generic answer is yes: Basically you have to make a new function that<br>
calls the method with a specifc plot instance.<br>
<br>
def update_specific_plot():<br>
    analysis_client.update_plot(specific_plot_instance)<br>
data.connect(&quot;new_data_point&quot;, update_specific_plot)<br>
<br>
A more elegant and more general version of the above would create the helper<br>
function on the fly using functools.partial():<br>
<br>
from functools import partial<br>
<br>
data.connect(&quot;new_data_point&quot;,<br>
    partial(analysis_client.update_plot, specific_plot_instance))<br>
<br>
<br>
_______________________________________________<br>
Tutor maillist  -  <a href="mailto:Tutor@python.org">Tutor@python.org</a><br>
To unsubscribe or change subscription options:<br>
<a href="http://mail.python.org/mailman/listinfo/tutor" target="_blank">http://mail.python.org/mailman/listinfo/tutor</a><br>
</blockquote></div><br></div>