Discussion:
Chaco-users Digest, Vol 70, Issue 2
user 1713952
2013-03-31 19:04:31 UTC
Permalink
Thanks for the fast answer!

I have done what you suggest, but I don't see how I can monitor changes on
that variable myvar. Could you please be more explicit about that?
I have included the following in the class Demo:
@on_trait_change('plot.myvar')
def update_xy(self):
print "x,y have changed:", self.plot.myvar

Note that:
class Demo(HasTraits):
plot = Instance(Component)

how do I get notifications when plot (or plot.myvar) changes?

by the way, is myvar in this context an attribute of ScatterPlot only? In
that case how do I access it from the plot object (which is a component
containining, I guess, a ScatterPlot as renderer)? Or am I missing
something?

Cheers
A.
Send Chaco-users mailing list submissions to
To subscribe or unsubscribe via the World Wide Web, visit
https://mail.enthought.com/mailman/listinfo/chaco-users
or, via email, send a message with subject or body 'help' to
You can reach the person managing the list at
When replying, please edit your Subject line so it is more specific
than "Re: Contents of Chaco-users digest..."
1. Retrieving coordinates from draggable point (user 1713952)
2. Re: Retrieving coordinates from draggable point (?????? ?????)
----------------------------------------------------------------------
Message: 1
Date: Sun, 31 Mar 2013 01:46:58 +0100
Subject: [Chaco-users] Retrieving coordinates from draggable point
<CAL9qMVNetrCryg5fwyitjWpkY=
Content-Type: text/plain; charset="iso-8859-1"
Hi,
I have modified the example provided in the following link, by replacing
https://github.com/enthought/chaco/blob/master/examples/demo/edit_line.py
the point is displayed alright and I can of course drag it around, so far
so good. I would like to retrieve the point's coordinates as I drag it
around.
How can I do that?
I have added an Array trait in the demo definition, for each of the
coordinates, and then implement a function with the
@on_trait_change('my_x_array, my_y_array') but nothing happens.
Could someone please provide me some help?
Thanks
A.
-------------- next part --------------
An HTML attachment was scrubbed...
http://mail.enthought.com/pipermail/chaco-users/attachments/20130331/f6c817eb/attachment-0001.html
------------------------------
Message: 2
Date: Sun, 31 Mar 2013 08:56:26 +0600
Subject: Re: [Chaco-users] Retrieving coordinates from draggable point
<CAEcANh5wTMTdgE8uXH=
Content-Type: text/plain; charset="iso-8859-1"
* 1) Make some variable in your plot*
ScatterPlot(index = lineplot.index, value = lineplot.value, ..., myvar =
[])
*
*
*2) Then in function dragging*
...
plot.myvar = (event.x, event.y)
plot.request_redraw ()
Hi,
I have modified the example provided in the following link, by replacing
https://github.com/enthought/chaco/blob/master/examples/demo/edit_line.py
the point is displayed alright and I can of course drag it around, so far
so good. I would like to retrieve the point's coordinates as I drag it
around.
How can I do that?
I have added an Array trait in the demo definition, for each of the
coordinates, and then implement a function with the
@on_trait_change('my_x_array, my_y_array') but nothing happens.
Could someone please provide me some help?
Thanks
A.
_______________________________________________
Chaco-users mailing list
https://mail.enthought.com/mailman/listinfo/chaco-users
-------------- next part --------------
An HTML attachment was scrubbed...
http://mail.enthought.com/pipermail/chaco-users/attachments/20130331/8fbd1de4/attachment-0001.html
------------------------------
_______________________________________________
Chaco-users mailing list
https://mail.enthought.com/mailman/listinfo/chaco-users
End of Chaco-users Digest, Vol 70, Issue 2
******************************************
Loading...