Closed
Description
In Gtk3 applications using pygobject, scrolling does not seem to work in matplotlib widgets. While each button_press_event is registered normally, there are no scroll_events. For all other widgets, scrolling works normally.
I tried both the Gtk3Agg and Gtk3cairo backends without success, it does work with pygtk and the gtkagg backend though.
I've attached a simple example program [4] to illustrate the problem. To test with different backends, simply use the appropriate imports: [1][2][3]
[1] pygtk imports:
import gtk as Gtk
from matplotlib.figure import Figure
from matplotlib.backends.backend_gtkagg import FigureCanvasGTKAgg as FigCanvas
[2] Gtk3agg imports:
from gi.repository import Gtk
from matplotlib.figure import Figure
from matplotlib.backends.backend_gtk3agg import FigureCanvasGTK3Agg as FigCanvas
[3] Gtk3cairo imports:
from gi.repository import Gtk
from matplotlib.figure import Figure
from matplotlib.backends.backend_gtk3cairo import FigureCanvasGTK3Cairo as FigCanvas
[4] Code of example except imports:
def on_press(canvas, event):
print "press!"
def on_scroll(canvas, event):
print "scroll!"
window = Gtk.Window()
window.connect("delete-event", Gtk.main_quit)
figure = Figure(figsize=(5,4), dpi=100)
plot = figure.add_subplot(111)
plot.plot([0,0.5,2])
canvas = FigCanvas(figure)
canvas.connect('button_press_event', on_press)
canvas.connect('scroll_event', on_scroll)
window.add(canvas)
window.show_all()
Gtk.main()
Metadata
Metadata
Assignees
Labels
No labels