Why does wx.Window.CaptureMouse() send EVT_PAINT
Bill Jackson
jackson at hotmail.com
Thu Dec 7 17:27:07 EST 2006
It seems that the CaptureMouse method sends an EVT_PAINT handler. The
documentation does not mention this...is it somewhere else? Could
someone explain why this handler is sent out?
Also, I've seen:
def OnMouseDown(self, evt):
self.CaptureMouse()
self.x, self.y = self.lastx, self.lasty = evt.GetPosition()
self.Refresh(False)
Given that CaptureMouse initiates a repaint, isn't self.Refresh(False)
moot at the point.
Thanks. The doc for CaptureMouse are below.
---------
CaptureMouse(self)
Directs all mouse input to this window. Call wx.Window.ReleaseMouse to
release the capture.
Note that wxWindows maintains the stack of windows having captured the
mouse and when the mouse is released the capture returns to the window
which had had captured it previously and it is only really released if
there were no previous window. In particular, this means that you must
release the mouse as many times as you capture it, unless the window
receives the wx.MouseCaptureLostEvent event.
Any application which captures the mouse in the beginning of some
operation must handle wx.MouseCaptureLostEvent and cancel this operation
when it receives the event. The event handler must not recapture mouse.
More information about the Python-list
mailing list