|
From: Ethan A M. <merritt@u.washington.edu> - 2004-01-11 21:23:19
|
On Thursday 08 January 2004 12:05 pm, Arnd Baecker wrote:
> I would like to do something like this
> #####################################
> from GnuplotBiDir import Gnuplot
> gp=Gnuplot()
> gp("set mouse") # activate mouse
> gp("plot sin(x)")
> print "Now get coordinates of a mouse-click:"
> gp("pause mouse 'click with mouse' ")
> #raw_input("and press enter here after that")
> mouse_x=gp.getvar("MOUSE_X")
> mouse_y=gp.getvar("MOUSE_Y")
> print mouse_x,mouse_y
> ######################################
> Of course, this cannot work as the calling program does not
> wait for the mouse-click.
I have placed a fix for this in CVS. 'pause mouse' was terminating
on either a mouse click or a <cr> on stdin. That is OK for
terminal input, but with piped input there may already be multiple
commands backed up in the pipe, in which case it would not wait
for a mouse click. As of now the behaviour is changed to only
terminate 'pause mouse' on a mouse click or on ctrl-C.
I also added some sanity checking so that you cannot get
stuck waiting for 'pause mouse' if mousing is not active.
Note that requesting "set mouse" before plotting is essential.
The default for piped input is to disable mousing.
--
Ethan A Merritt
Department of Biochemistry & Biomolecular Structure Center
University of Washington, Seattle
|