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.
EVT_PAINT handlers are obviously called by the wxPython event system, so there is no way to put try: except around the call. Where in your code have you hoped that exception handling could catch exceptions occuring inside the handler?
Christian
I have a custom EVT_PAINT handler, let's call it OnPaint. OnPaint
makes a call to another method, which could raise an exception. I'm
curious as to what wxPython's event handling does with this handler,
as it does not exit normally, due to the exception raised by the
method it calls. I've solved the problem by setting event.Skip()
_before_ calling the exception-raising method, but I'm still curious.
···
On 7/3/07, Christian K. <ckkart@hoc.net> wrote:
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.
EVT_PAINT handlers are obviously called by the wxPython event system, so
there is no way to put try: except around the call. Where in your code
have you hoped that exception handling could catch exceptions occuring
inside the handler?
Charl P. Botha wrote:
I'm
curious as to what wxPython's event handling does with this handler,
as it does not exit normally, due to the exception raised by the
method it calls.
Is that before you create a PaintDC? I think it's required that an EVT_PAINT handler create a PaintDC -- if that doesn't happen perhaps the system thinks the screen still needs to be painted (which is does!), and raised the event again.
-Chris
···
--
Christopher Barker, Ph.D.
Oceanographer
Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
Chris.Barker@noaa.gov