key_press_event weirdness

John Hunter <jdh2358@...83...> writes:

I am not seeing this on Linux x86_64 with backend GTKAgg version
2.22.0 on python 2.7. Eg, if I run:

    > python simple_plot.py -dgtkagg

and then hover over the axes window (w/o clicking on it but the window
has the focus on hover) and press 'g') the grids is toggled.

JDH

You're right, John, it works here too with the gtkagg backend. I have just
noticed that I had different backend options set in matplotlib.conf and
matplotlibrc. My initial report refers then to the Qt4Agg backend.

BTW, which of matplotlib.conf or matplotlibrc is preferred?

jorges

OK, I can confirm this too on Qt4Agg version 4.8.3.

···

On Fri, Oct 14, 2011 at 8:46 AM, Jorge Scandaliaris <jorgesmbox-ml@...1664...> wrote:

You're right, John, it works here too with the gtkagg backend. I have just
noticed that I had different backend options set in matplotlib.conf and
matplotlibrc. My initial report refers then to the Qt4Agg backend.

I opened an issue here

    key press events require window click in qt4agg · Issue #525 · matplotlib/matplotlib · GitHub

I am no qt expert so perhaps someone else can suggest a solution. In
the gtk backend, I believe we added:

    self.canvas.grab_focus()

to support events w/o clicking on the canvas.

···

On Fri, Oct 14, 2011 at 8:52 AM, John Hunter <jdh2358@...287...> wrote:

On Fri, Oct 14, 2011 at 8:46 AM, Jorge Scandaliaris > <jorgesmbox-ml@...1664...> wrote:

You're right, John, it works here too with the gtkagg backend. I have just
noticed that I had different backend options set in matplotlib.conf and
matplotlibrc. My initial report refers then to the Qt4Agg backend.

OK, I can confirm this too on Qt4Agg version 4.8.3.