Re: Reading mouse input from an x11 graphics window

From: Raymond P. <rtp1_at_nyahnyahspammersnyahnyah>
Date: Thu, 10 Nov 2005 15:40:58 -0600

No problem. I'm always amazed at how quickly things get answered on
this list.

 From looking at the function that ncl served, now carried into PyNGL,
I was already
pretty sure that there was no standard way to do what I wanted. The
function, which
I think should still be the core function of PyNGL is to generate
graphics
from scripts, rather than to write menu-driven interactive graphics
programs.

It did occur to me, though, that the one small bit if interactive
capability that would greatly
enhance PyNGL would be to read a mouse position from a click. I felt
this lack
in the dynamical systems course I'm teaching now, which uses Python for
its
programming language and PyNGL for graphics. It would be awfully nice
to
be able to start a trajectory with a mouse click, rather than inputting
coordinates
to the script.

I mainly tossed out this query as a way of planting the idea that it
would be nice
to be able to do such a thing, so as to stimulate some discussion.

--Ray

On Nov 9, 2005, at 6:51 PM, Mary Haley wrote:

> Hi Ray,
>
> I'm sorry we haven't responded to this sooner. We discussed this
> question
> informally at lunch yesterday, and don't have any current way to
> do something like this in PyNGL.
>
> We do have a C/HLU library example (the HLU library is something that
> PyNGL is built on top of) in which you can click on the X11 window,
> and it returns the data coordinates. This is "ng4ex" example "xy13c"
> for those of you that might have the HLUs installed on your system.
>
> It requires the X11 "Xm" library in order to compile.
>
> Does anybody know of some Python/X11 modules? It might be possible to
> convert this example to PyNGL and use similar X11 calls as in the
> xy13c.c example.
>
> --Mary
>
>
> On Mon, 7 Nov 2005, Raymond P. wrote:
>
>> This may be too much to hope for, but here goes....
>>
>> For some courseware I'm writing, I'd like to write a script that can
>> read the
>> coordinates of a mouse click on a PyNGL x11 window, and use that
>> to initialize an equation for further plotting on the window. I know
>> how to
>> do this sort of thing in tkinter, but I wonder if NGL has some
>> facility for
>> doing this, or if perhaps somebody knows some hack for getting
>> the screen coordinates using tkinter calls and translating to the NGL
>> graphics space. It would be a handy sort of thing to be able to do for
>> all sorts of interactive graphics applications.
>>
>> Thanks,
>> Ray
>>
>> _______________________________________________
>> pyngl-talk mailing list
>> pyngl-talk_at_ucar.edu
>> http://mailman.ucar.edu/mailman/listinfo/pyngl-talk
>>
Received on Thu Nov 10 2005 - 14:40:58 MST

This archive was generated by hypermail 2.2.0 : Thu Jan 19 2006 - 21:31:54 MST