-
-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Closed
Description
- Matplotlib version = 1.5.1
- Python version = 2.7.6
- Platform = Linux, Ubuntu 14.04
- How did you install Matplotlib and Python = python from ubuntu apt, pip install matplotlib
- Example code below
If you use the gtk3-based backends (I had gtk3agg and gtk3cairo installed), and capture keypress events, it works, until you hit the down arrow. The down arrow cause the buttons on the toolbar to be "selected" with a little marquee box, which you can move left/right with the arrow keys. But keys no longer go to the key_press_event handler. Other backends work as expected, all arrow keys are always captured.
import matplotlib
# Broken. Toolbar appears along the bottom. Hit the 'down' key, and the selection marquee appears around the
# buttons in the toolbar. All furthur keypresses go to the toolbar, not the graph window.
# matplotlib.use('gtk3agg')
# matplotlib.use('gtk3cairo')
# OKAY
# matplotlib.use('wxagg')
# matplotlib.use('wx')
# matplotlib.use('tkagg')
# matplotlib.use('qt4agg')
import matplotlib.pyplot as plt
import numpy as np
fig, ax = plt.subplots(1, 1)
x = np.linspace(0, 3*np.pi/2, 1000)
y = np.sin(x)
ax.plot(x, y)
def press(event):
print "press", event.key
fig.canvas.mpl_connect('key_press_event', press)
plt.show()Reactions are currently unavailable