On Tue, Jul 13, 2010 at 5:34 AM, Preben Randhol <rand...@pvv.org> wrote:
> Hi
>
> I have tried the mpl and glade examples and tried different approaches
> from the net, but I can only get button_press_event to work with a matplot
> canvas. key_press_event does not work using gtkagg for GUI.
>
> Is this due to the gtk builder 2.16? I mean does the main window steal the
> key_presses or something?
>
> I had previously tried an example without a gtk gui (don't remember the
> example). There a callback was connected and it could get events
> containing both mouse click and keypress. I mean if I pressed the mouse
> button while keeping doen say 'e' I could get form event.key that 'e' was
> pressed when I click the mouse.
>
> I have to use gtk for the rest of the GUI so when I tried to pack the
> canvas into gtk I got the problem that callbacks and connections didn't
> work. i guess it has to do with that gtk has it's own callback system.
>
> If anybody has some example code, tips or tricks, I would very much
> appreciate that. I cannot at the moment provide an example code due to
> project deadline, but will do afterwards.

I've seen this before when an mpl canvas is placed in a gtk notebook
widget for example.  The containing class swallows the kwy press
event.  What has worked for me before is to grab the focus with the
mpl FigureCanvas:

  canvas.grab_focus()

Thanks,
JDH

------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to