Drag on scatterplot and coordinates retrieval

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Drag on scatterplot and coordinates retrieval

This post has NOT been accepted by the mailing list yet.

I have taken the file: https://github.com/enthought/chaco/tree/master/examples/demo/edit_line.py
and attempted to modify it so that only one point is kept on the graph and that its coordinates get displayed in the ui. Ultimately, I want to reuse those to change the inputs of my model.

Here is the modified file: https://gist.github.com/user1713952/5286824

I have tried to use @on_trait_change with what I believed to be the "path" to the property I am intrested in but to no avail. This property is changed by the DragTool.

How can I create the coordinate property inside my main class (Demo) and then ensure that it is the same that is being acted upon by the drag tool?
The plot attribute is actually a container which has a certain number of plots. One of them (which happens to be a ScatterPlot) has the dragtool attached to it. So when one grabs the point on the screen with the mouse, how can the new coordinates be listened at and passed on to the Demo object?

Could someone please take the 5min it will take to help me out? I have struggling with for a week with that simple example and I think it is time to ask for help.

Thanks a lot