[wxPython-users] EVT_PAINT handler raising excption,
gets called repeatedly
Charl P. Botha
cpbotha at cpbotha.net
Tue Jul 3 15:38:08 PDT 2007
On 7/3/07, Robin Dunn <robin at alldunn.com> wrote:
> On Windows a EVT_PAINT handler *must* create a wx.PaintDC (or use
> something that creates a wx.PaintDC like a wx.BufferedPaintDC) otherwise
> the system thinks that the event hasn't been handled yet and will send
> another paint message immediately. So that is probably happening is
> your exception is being raised before the wx.PaintDC is being created
> and so it is skipped and windows thinks is needs to paint again.
Thanks Robin and Christopher, this is the kind of information I was after!
I'm working on the wxVTKRenderWindowInteractor in VTK CVS to make it
safe for Python exceptions. I've been testing a VTK patch I made (and
will probably commit soon) to turn VTK errors into Python exceptions
(this is not the case currently), and have been making certain other
parts of the code aware of this new behaviour. So a Render() called
from the OnPaint() handler was raising an exception (due to no input)
and then there'd be repeated calls of the OnPaint handler. The
PaintDC was created before the Render() call, so I'm not sure what
exactly caused this behaviour. After having added an event.Skip()
before the Render(), I'm not seeing the repeated callbacks anymore.
Thanks again,
Charl
More information about the wxpython-users
mailing list