changing the cursor position with a key press

Does anyone have an example showing how to change the cursor position
using the key pad instead of the mouse?

-Mathew

Are you talking about externally to mpl or within mpl? I have some code from a couple of months ago that automated graph interaction that allowed me to exactly reproduce various actions so I could profile the execution.

It uses the Gtk accessibility framework to control the mouse.

Ben Root

···

On Wednesday, August 17, 2011, Mathew Yeates <mat.yeates@…287…> wrote:

Does anyone have an example showing how to change the cursor position
using the key pad instead of the mouse?

-Mathew

I'm looking for something like

···

---------
display = gdk_display_get_default ();
    screen = gdk_display_get_default_screen (display);

    /* get cursor position */
    gdk_display_get_pointer (display, NULL, &x, &y, NULL);

    /* set new cusor position */
    x += xadd;
    y += yadd;
    gdk_display_warp_pointer (display, screen, x, y);

On Wed, Aug 17, 2011 at 11:52 PM, Benjamin Root <ben.root@...1304...> wrote:

On Wednesday, August 17, 2011, Mathew Yeates <mat.yeates@...287...> wrote:

Does anyone have an example showing how to change the cursor position
using the key pad instead of the mouse?

-Mathew

Are you talking about externally to mpl or within mpl? I have some code
from a couple of months ago that automated graph interaction that allowed me
to exactly reproduce various actions so I could profile the execution.

It uses the Gtk accessibility framework to control the mouse.

Ben Root

Here is how to do it
    display=mainwindow.get_display()
    screen = gtk.gdk.Display.get_default_screen(display)
    x,y=mainwindow.get_pointer()
    s,x,y,m = display.get_pointer()
    gtk.gdk.Display.warp_pointer(display, screen,x+1,y)

···

On Wed, Aug 17, 2011 at 11:53 PM, Mathew Yeates <mat.yeates@...287...> wrote:

I'm looking for something like
---------
display = gdk_display_get_default ();
screen = gdk_display_get_default_screen (display);

/* get cursor position */
gdk_display_get_pointer (display, NULL, &x, &y, NULL);

/* set new cusor position */
x += xadd;
y += yadd;
gdk_display_warp_pointer (display, screen, x, y);

On Wed, Aug 17, 2011 at 11:52 PM, Benjamin Root <ben.root@...1304...> wrote:

On Wednesday, August 17, 2011, Mathew Yeates <mat.yeates@...287...> wrote:

Does anyone have an example showing how to change the cursor position
using the key pad instead of the mouse?

-Mathew

Are you talking about externally to mpl or within mpl? I have some code
from a couple of months ago that automated graph interaction that allowed me
to exactly reproduce various actions so I could profile the execution.

It uses the Gtk accessibility framework to control the mouse.

Ben Root

Ok, glad that works for you. For reference, the email I was referring to is here:

http://www.mail-archive.com/matplotlib-devel@lists.sourceforge.net/msg08321.html

The toolkit offers a bunch of other tools for scripting out interaction, in case anybody cares about that sort of thing. (actually, might be a good idea to consider adding stuff like that to the testing suite…)

Ben Root

···

On Wed, Aug 17, 2011 at 7:01 PM, Mathew Yeates <mat.yeates@…83…287…> wrote:

Here is how to do it

display=mainwindow.get_display()

screen = gtk.gdk.Display.get_default_screen(display)

x,y=mainwindow.get_pointer()

s,x,y,m = display.get_pointer()

gtk.gdk.Display.warp_pointer(display, screen,x+1,y)

cool,

···

On Wed, Aug 17, 2011 at 5:15 PM, Benjamin Root <ben.root@...1304...> wrote:

On Wed, Aug 17, 2011 at 7:01 PM, Mathew Yeates <mat.yeates@...287...> wrote:

Here is how to do it
display=mainwindow.get_display()
screen = gtk.gdk.Display.get_default_screen(display)
x,y=mainwindow.get_pointer()
s,x,y,m = display.get_pointer()
gtk.gdk.Display.warp_pointer(display, screen,x+1,y)

Ok, glad that works for you. For reference, the email I was referring to is
here:

Re: [matplotlib-devel] scripting interaction

The toolkit offers a bunch of other tools for scripting out interaction, in
case anybody cares about that sort of thing. (actually, might be a good idea
to consider adding stuff like that to the testing suite...)

Ben Root