[Matplotlib-users] wxbackend scroll_event troubles
Yves Le Feuvre
lefeuvreyves33 at gmail.com
Mon Oct 5 09:06:25 CEST 2015
Hello,
on my macOSX (didn't check other
OS), canvas.mpl_connect('scroll_event',...) misses every other event when I
use mouse wheel
(wx.EVT_MOUSEWHEEL works fine and all mouse wheel are reported)
exemple code to illustrate the bug (feature?):
in right panel, all mouse wheel events are reported
in left panel (matplotlib panel), every other two event is missing
#!/usr/bin/env python
# -*- coding: iso-8859-1 -*-#
import wx
import numpy
import matplotlib
import sys
from matplotlib.figure import Figure
from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg as
FigureCanvas
class TestFrame(wx.Frame):
def __init__(self,parent,title):
wx.Frame.__init__(self,parent,title=title,size=(500,500))
self.sp = wx.SplitterWindow(self)
self.p1 = WxPanel(self.sp)
self.p2 = MplPanel(self.sp)
self.sp.SplitVertically(self.p1,self.p2)
class WxPanel(wx.Panel):
def __init__(self, parent):
wx.Panel.__init__(self, parent,-1,size=(50,50))
self.Bind(wx.EVT_MOUSEWHEEL,self.OnMouseWheel)
def OnMouseWheel(self,event):
print "wx scroll event"
sys.stdout.flush()
class MplPanel(wx.Panel):
def __init__(self, parent):
wx.Panel.__init__(self, parent,-1,size=(50,50))
self.figure = Figure()
self.axes = self.figure.add_subplot(111)
self.axes.plot(numpy.arange(0.0,10,1.0),[0,1,0,1,0,2,1,2,1,0])
self.canvas = FigureCanvas(self,-1,self.figure)
self.canvas.mpl_connect('scroll_event', self.OnMouseWheel)
def OnMouseWheel(self,event):
print "mpl scroll event"
sys.stdout.flush()
app = wx.App(redirect=False)
frame = TestFrame(None, 'Hello World!')
frame.Show()
app.MainLoop()
any idea how to solve that behavior?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/matplotlib-users/attachments/20151005/b37310b7/attachment-0001.html>
More information about the Matplotlib-users
mailing list