Hi again,
Good news : I have been able to isolate the crash problem, and to make it
reproducible.
In the attached code :
* *when 1 event is bound to a rectangle* (made with AddRectangle), and you
click down on it, and then move away the mouse to the Windows taskbar, and
release the mouse up there, there is no problem
* Please uncomment line #14 in the attached code : *now 2 events are bound
to the same rectangle*, then you click down on it, and then move away the
mouse to the Windows taskbar, and release the mouse up there, then there is
a crash ! (Do it twice, 3 times ... or maximum 5 times, you will have
probably have a crash, I have it on Windows 7).
Do you have an idea on the cause ?
Best regards,
Jo
PS : Here is the code :
import wx
from wx.lib.floatcanvas import FloatCanvas
class TestFrame(wx.Frame):
def __init__(self, *args, **kwargs):
wx.Frame.__init__(self, *args, **kwargs)
self.canvas =FloatCanvas.FloatCanvas(self, BackgroundColor = "DARK
SLATE BLUE")
MainSizer = wx.BoxSizer(wx.VERTICAL)
MainSizer.Add(self.canvas, 4, wx.EXPAND)
self.SetSizer(MainSizer)
self.canvas.Bind(FloatCanvas.EVT_LEFT_DOWN, self.OnLeftDown)
A = self.canvas.AddRectangle((10,10), (100, 20), FillColor="red")
A.Bind(FloatCanvas.EVT_FC_LEFT_DOWN, self.OnRectDown)
#A.Bind(FloatCanvas.EVT_FC_LEFT_UP, self.OnRectUp) # Uncomment
this line, then click down on the rectangle, move the cursor to the Windows
taskbar, click up : crash !
wx.CallAfter(self.canvas.ZoomToBB)
def OnLeftDown(self, event):
print 'Left Button down clicked at:', event.Coords
def OnRectDown(self, event):
print 'Rectangle: Left Button down clicked at:', event.HitCoords
self.canvas.CaptureMouse()
def OnRectUp(self, event):
print 'Rectangle: Left Button up clicked at:', event.HitCoords
if self.canvas.HasCapture():
self.canvas.ReleaseMouse()
app = wx.App(0)
frame = TestFrame(None, title = "Mouse Event Tester")
frame.Show(True)
app.MainLoop()
import wx
from wx.lib.floatcanvas import FloatCanvas
class TestFrame(wx.Frame):
def __init__(self, *args, **kwargs):
wx.Frame.__init__(self, *args, **kwargs)
self.canvas =FloatCanvas.FloatCanvas(self, BackgroundColor = "DARK SLATE BLUE")
MainSizer = wx.BoxSizer(wx.VERTICAL)
MainSizer.Add(self.canvas, 4, wx.EXPAND)
self.SetSizer(MainSizer)
self.canvas.Bind(FloatCanvas.EVT_LEFT_DOWN, self.OnLeftDown)
A = self.canvas.AddRectangle((10,10), (100, 20), FillColor="red")
A.Bind(FloatCanvas.EVT_FC_LEFT_DOWN, self.OnRectDown)
#A.Bind(FloatCanvas.EVT_FC_LEFT_UP, self.OnRectUp) # Uncomment this line, then click down on the rectangle, move the cursor to the Windows taskbar, click up : crash !
wx.CallAfter(self.canvas.ZoomToBB)
def OnLeftDown(self, event):
print 'Left Button down clicked at:', event.Coords
def OnRectDown(self, event):
print 'Rectangle: Left Button down clicked at:', event.HitCoords
self.canvas.CaptureMouse()
def OnRectUp(self, event):
print 'Rectangle: Left Button up clicked at:', event.HitCoords
if self.canvas.HasCapture():
self.canvas.ReleaseMouse()
app = wx.App(0)
frame = TestFrame(None, title = "Mouse Event Tester")
frame.Show(True)
app.MainLoop()
_______________________________________________
FloatCanvas mailing list
[email protected]
http://mailman.paulmcnett.com/cgi-bin/mailman/listinfo/floatcanvas