Key events using nbagg backend

I'm using matplotlib version 1.4.2 on linux and am having trouble getting key
event
callbacks when using the nbagg backend in an ipython notebook (i've tried in
firefox and chromium).
The key press events seem to not be processed (no matter what key I try to
press). This code does work with the qt backend.

%matplotlib nbagg
import matplotlib.pyplot as plt
f=plt.figure()
plt.plot([1,2,3,4])
def handler(event):
    plt.plot([4,3,2,1])
f.canvas.mpl_connect('key_press_event',handler);

Thanks for any help.

···

--
View this message in context: http://matplotlib.1069221.n5.nabble.com/Key-events-using-nbagg-backend-tp44551.html
Sent from the matplotlib - users mailing list archive at Nabble.com.

Nbagg is non-interactive, similar to Agg. No events other than draw events are supported, as far as I know.

I think there are long term plans to change that (eg, webagg and mplh5canvas), but it’s a fairly tricky problem.

How that helps clarify why things aren’t working, anyway.
-Joe

···

On Dec 4, 2014 11:04 AM, “reem17” <elwin@…4604…> wrote:

I’m using matplotlib version 1.4.2 on linux and am having trouble getting key

event

callbacks when using the nbagg backend in an ipython notebook (i’ve tried in

firefox and chromium).

The key press events seem to not be processed (no matter what key I try to

press). This code does work with the qt backend.

%matplotlib nbagg

import matplotlib.pyplot as plt

f=plt.figure()

plt.plot([1,2,3,4])

def handler(event):

plt.plot([4,3,2,1])

f.canvas.mpl_connect(‘key_press_event’,handler);

Thanks for any help.

View this message in context: http://matplotlib.1069221.n5.nabble.com/Key-events-using-nbagg-backend-tp44551.html

Sent from the matplotlib - users mailing list archive at Nabble.com.


Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server

from Actuate! Instantly Supercharge Your Business Reports and Dashboards

with Interactivity, Sharing, Native Excel Exports, App Integration & more

Get technology previously reserved for billion-dollar corporations, FREE

http://pubads.g.doubleclick.net/gampad/clk?id=164703151&iu=/4140/ostg.clktrk


Matplotlib-users mailing list

Matplotlib-users@lists.sourceforge.net

https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Thanks for the response Joe.
I guess keyboard events are just not implemented yet.
Mouse events (at least button_press_event) do seem to work.

···

--
View this message in context: http://matplotlib.1069221.n5.nabble.com/Key-events-using-nbagg-backend-tp44551p44553.html
Sent from the matplotlib - users mailing list archive at Nabble.com.

If that's the case, the release notes should probably make that clear. Right now at http://matplotlib.org/users/whats_new.html#the-nbagg-backend it says: "Phil Elson added a new backend, named “nbagg”, which enables interactive figures in a live IPython notebook session." The word "interactive" certainly could lead people to believe that the backend is, in fact, interactive.

···

On 2014-12-04 15:40, Joe Kington wrote:

Nbagg is non-interactive, similar to Agg. No events other than draw events
are supported, as far as I know.

--
Brendan Barnwell
"Do not follow where the path may lead. Go, instead, where there is no path, and leave a trail."
    --author unknown

Woops! You’re absolutely right! I was completely confused!

I mixed up the new “nbagg” backend with the way ipython notebooks used to display matplotlib figures. The nbagg backend is indeed interactive (and I have no idea why key press callbacks aren’t supported, then).

This is what happens when I reply to e-mail without putting much thought into it.

Thanks!

-Joe

···

On Thu, Dec 4, 2014 at 8:58 PM, Brendan Barnwell <brenbarn@…4605…> wrote:

On 2014-12-04 15:40, Joe Kington wrote:

Nbagg is non-interactive, similar to Agg. No events other than draw events

are supported, as far as I know.

    If that's the case, the release notes should probably make that clear.

Right now at

http://matplotlib.org/users/whats_new.html#the-nbagg-backend it says:

"Phil Elson added a new backend, named “nbagg”, which enables

interactive figures in a live IPython notebook session." The word

“interactive” certainly could lead people to believe that the backend

is, in fact, interactive.

Brendan Barnwell

"Do not follow where the path may lead. Go, instead, where there is no

path, and leave a trail."

--author unknown

Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server

from Actuate! Instantly Supercharge Your Business Reports and Dashboards

with Interactivity, Sharing, Native Excel Exports, App Integration & more

Get technology previously reserved for billion-dollar corporations, FREE

http://pubads.g.doubleclick.net/gampad/clk?id=164703151&iu=/4140/ostg.clktrk


Matplotlib-users mailing list

Matplotlib-users@lists.sourceforge.net

https://lists.sourceforge.net/lists/listinfo/matplotlib-users