It works well in my system (linux gentoo) with ipython-4.0.3,
python-2.7.10 and python-3.4.3.
Did you try running it outside spyder?
May be save it into a file (test_cursor.py) and run it directly from a
system console to see if the problem is with spyder.
Anyway, I am not very experienced. May be someone else may have a better
advice.
Regards,
Juan
···
On 30/05/16 07:17, grivet wrote:
Hello,
I want to retrieve the mouse cursor coordinates when i click inside a
figure. I have tried a variety ef example programs, such as
It works well in my system (linux gentoo) with ipython-4.0.3,
python-2.7.10 and python-3.4.3.
Did you try running it outside spyder?
May be save it into a file (test_cursor.py) and run it directly from a
system console to see if the problem is with spyder.
Anyway, I am not very experienced. May be someone else may have a better
advice.
Regards,
Juan
Hello,
I want to retrieve the mouse cursor coordinates when i click inside a
figure. I have tried a variety ef example programs, such as
Ok, I do not use spyder so I may be wrong, but it looks that it works if
in the preferences windows (Tools -> Preferences)
in the option:
"IPython console"
In the tab:
"Graphics"
you select the Backend:
"Automatic"
You probably have to restart spyder for it to work.
Regards,
Juan
···
On 30/05/16 11:40, grivet wrote:
Le 30/05/2016 ? 14:36, Juan a ?crit :
It works well in my system (linux gentoo) with ipython-4.0.3,
python-2.7.10 and python-3.4.3.
Did you try running it outside spyder?
May be save it into a file (test_cursor.py) and run it directly from a
system console to see if the problem is with spyder.
Anyway, I am not very experienced. May be someone else may have a better
advice.
Regards,
Juan
On 30/05/16 07:17, grivet wrote:
Hello,
I want to retrieve the mouse cursor coordinates when i click inside a
figure. I have tried a variety ef example programs, such as
Right again! A separate window is now created and I can click inside and
retrieve the pointer coordinates.
Thanks a lot,
JP Grivet
···
Ok, I do not use spyder so I may be wrong, but it looks that it works if
in the preferences windows (Tools -> Preferences)
in the option:
"IPython console"
In the tab:
"Graphics"
you select the Backend:
"Automatic"
You probably have to restart spyder for it to work.
Regards,
Juan
On 30/05/16 11:40, grivet wrote:
Le 30/05/2016 ? 14:36, Juan a ?crit :
It works well in my system (linux gentoo) with ipython-4.0.3,
python-2.7.10 and python-3.4.3.
Did you try running it outside spyder?
May be save it into a file (test_cursor.py) and run it directly from a
system console to see if the problem is with spyder.
Anyway, I am not very experienced. May be someone else may have a better
advice.
Regards,
Juan
On 30/05/16 07:17, grivet wrote:
Hello,
I want to retrieve the mouse cursor coordinates when i click inside a
figure. I have tried a variety ef example programs, such as
Hello,
I would like to go further and, in fact, do the following:
repeat n times
click inside a figure
retrieve and store the pointer coordinates
show a mark (or circle or whatever) at this point
Thank you for your suggestions
JP Grivet
···
Right again! A separate window is now created and I can click inside
and retrieve the pointer coordinates.
Thanks a lot,
JP Grivet
Ok, I do not use spyder so I may be wrong, but it looks that it works if
in the preferences windows (Tools -> Preferences)
in the option:
"IPython console"
In the tab:
"Graphics"
you select the Backend:
"Automatic"
You probably have to restart spyder for it to work.
The trick is to register an instance method into the callbacks so that you
can keep state between calls.
Tom
···
On Fri, Jun 3, 2016 at 6:12 AM grivet <grivet at cnrs-orleans.fr> wrote:
Hello,
I would like to go further and, in fact, do the following:
repeat n times
click inside a figure
retrieve and store the pointer coordinates
show a mark (or circle or whatever) at this point
Thank you for your suggestions
JP Grivet
> Right again! A separate window is now created and I can click inside
> and retrieve the pointer coordinates.
> Thanks a lot,
> JP Grivet
>
>> Ok, I do not use spyder so I may be wrong, but it looks that it works if
>> in the preferences windows (Tools -> Preferences)
>> in the option:
>> "IPython console"
>> In the tab:
>> "Graphics"
>> you select the Backend:
>> "Automatic"
>>
>> You probably have to restart spyder for it to work.
>>
>> Regards,
>> Juan
I am used to programming in Scilab (or Matlab) and I wish to emulate the
following piece of code, in which I place 4
electric charges (of both signs) inside a rectangle in order to compute
later the resulting electric field.
np = 4; i = 1;
xinfo(""left click in window to place a charge (4 in all)");
while i <= np
[ib,xx,yy] = xclick(); //retrieve
button number and pointer coordinates
if abs(xx) < 5 & abs(yy) < 5 & ib==3 //inside plot and left button
xs(i) = xx; ys(i)=yy;
charge(i) = evstr(x_dialog("charge value: ","1"));
if charge(i) >0 then
plot2d(xs(i),ys(i),style = -4,strf="002") //blue dot
else
plot2d(xs(i),ys(i),style = -5,strf="002") //red dot
end
i = i+1;
end
xinfo("left click in window to place a charge (" + string(5-i) + "
charge(s) remaining)");
end
.......
Is it possible to write an analogous Python code ?
Hello,
I am still trying to plot some points inside a figure using the mouse,
while storing the
points' coordinates for further use. I found the following example,
which seems to
be a step in the right direction:
import matplotlib.pyplot as plt
plt.ion()
plt.xlim(0, 10)
plt.ylim(0, 10)
mse = 0
while mse != []:
mse = plt.ginput(timeout=10)
if mse != []:
print(mse)
plt.gca().add_artist(plt.Circle(mse[0], 0.1, alpha=0.9))
plt.close()
However, when I run this program (Spyder, Python 3.5, Win_7_64), I have
to click twice
inside the figure to draw a single point.
Any suggestion ?