wxPython-users Digest 26 Oct 2004 01:08:53 -0000 Issue 729

the onpaint calls the opengl drawing functions. But my problem is that

>> the Onpaint is only being called when the app is initalised. This was
>> not the case on windows where this function was called several times per
>> second.

>The EVT_PAINT handlers will be called only when the platform thinks that
> part of the window has been damaged and needs to be refreshed. (You
>can also tell the platform to send an event using Refresh()) The
>difference that you might be seeing is that on Windows if you don't
>create a wx.PaintDC then Windows will think that you have not yet
>handled the event and so it will send it again, and again, and... So if
>you create a wx.PaintDC (even if you don't use it) then you should see
>the same (correct) behaiour on Windows.

ok, so actually it not the best practice to do that

>If you want to update the window on a regular basis then you should
>create a wx.Timer and then either do the opengl drawing from that
>handler, or just call Refresh and wait for the platform to send another
>EVT_PAINT.

I see. What option do you reckon is more apropiated? would it be any performance difference or crossplatform issue to chose one over the other?

thanks!

···

--
enrike

altern wrote:

>If you want to update the window on a regular basis then you should
>create a wx.Timer and then either do the opengl drawing from that
>handler, or just call Refresh and wait for the platform to send another
>EVT_PAINT.

I see. What option do you reckon is more apropiated? would it be any performance difference or crossplatform issue to chose one over the other?

Doing it from the timer would probably be the best, but try it either way. Another way to try it is in the timer handler call both Refresh and Update. The Refresh will mark it as needing a paint event, and Update will cause the paint event to be sent right away.

···

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