Nasty mouse event problem with wxPython

Hi Stefan,

I've hit a problem when using the button_press_event to pop up a
wx.MessageBox. After the messagebox is loaded the mouse becomes completely
unresponsive (even outside the application) until the application is shut
down (by using ALT+F4). I'm making a feature where the user, after right
clicking on the figure (after doing some manipulations etc), are requested
to answer a question in a message box.

This problem seems only to occur on Linux..

Am I doing something wrong or is this a bug?

I've attached the source that demonstrates the problem.

Oddly, I saw very similar behavior recently (I didn't see the
attachment...). What I found was that the canvas was still
responsive, but that it "stole" the mouse from any other window (wx
widgets or system widgets) and that this happened on Linux but not

I believe that adding
at the end of the event handler will alleviate this problem. It might
be best to do (assuming you bound mouse events with the
    Canvas.mpl_connect() ) to do
    if self.HasCapture(): self.ReleaseMouse()

I haven't fully explored this problem myself, but I am no longer
experiencing it...


--Matt Newville <newville at>