Skip to content

Down arrow on GTK3 backends selects toolbar, which eats furthur keypress events #6349

@jtbraun

Description

@jtbraun
  • 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()

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions