Hi,
I have in my code a PlotCanvas window, which is called in a PyScrolledWindow
In the PlotCanvas, I have declared a handler on mouse left up, which work well.
But I need to propagate the event to the PyScrolledWindow and this cannot work.
Any idea ? I am not very familiar with Python.
Here are some part of the code (simplified) :
class VariableCanvas(plot.PlotCanvas):
def init(self, parent, id=wx.ID_ANY, pos=wx.DefaultPosition,
size=wx.DefaultSize, style=0, name=“plotCanvas”):
plot.PlotCanvas.init(self, parent, id, pos, size, style, name)
self.canvas.Bind(wx.EVT_LEFT_UP, self.OnLeftUp)
def OnLeftUp(self, event):
print "VARIABLE_CANVAS HANDLER OnLeftUp"
event.Skip()
class VariablesViewer(wx.PyScrolledWindow):
def init(self, parent, manager, range=None):
self.canvas = None
gridsizer = wx.FlexGridSizer(cols=2, hgap=5, rows=1, vgap=5)
gridsizer.AddGrowableCol(0)
gridsizer.AddGrowableRow(0)
self.MainSizer.AddSizer(gridsizer, 1, border=0, flag=wx.GROW)
# The graphic window : canvas
self.canvas = VariableCanvas(id=587, name="%s_canvas" ,
parent=self, pos=wx.Point(0, 0),
size=wx.Size(0, 0), style=wx.SUNKEN_BORDER)
self.canvas.SetMinSize(wx.Size(0, 150))
gridsizer.AddWindow(self.canvas, 0, border=0, flag=wx.GROW)
self.canvas.Bind(wx.EVT_LEFT_UP, self.VARIABLE_VIEWER_OnLeftUp)
def VARIABLE_VIEWER_OnLeftUp(self, event):
print “VARIABLES_VIEWER HANDLER OnLeftUp”
It goes in OnLeftUp(), but never goes in VARIABLE_VIEWER_OnLeftUp(). I have also tested the event EVT_SCROLL_THUMBRELEASE, without success.
Thank you to all.