[wxPython-users] EVT_PAINT handler raising excption, gets called repeatedly

Robin Dunn robin at alldunn.com
Tue Jul 3 14:15:41 PDT 2007


Charl P. Botha wrote:
> Dear all,
> 
> I'm running on Windows XP SP2 and wxPython 2.6.3.3.  If an EVT_PAINT
> handler is raising an exception (and thus not returning normally), is
> there any reason why it would then be repeatedly called?  If I catch
> the exception inside the event handler, it behaves as expected.
> 
> Any thoughts on this would be greatly appreciated.

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.


-- 
Robin Dunn
Software Craftsman
http://wxPython.org  Java give you jitters?  Relax with wxPython!





More information about the wxpython-users mailing list