insight on redrawing wanted (wxCalendar)

Adi Sieker wrote:

now the Calendar still draws correctly but as soon as I resize the parent frame
the Calendar starts flickering like crazy and I can't quit the app anymore.
This also happens in the demo, with the changed wxCalendar of course.

What I can't understand is why does reusing the CalDraw object cause flickering and creating a new object every redraw doesn't.

Does anybody have an explanaitionfor that?

I'm using WindowxXP, wxPython 2.4.2.4 with Python 2.3.2

On Windows continuous flickering like that usually means that a wxPaintDC was not created for the window that received a paint event. Since there was no DC created then Windows assumes that it still needs painting and so it sends the event again.

After a quick glance at calendar.py I don't see anything obvious like that happening, but maybe you will since you've been examining it more closely. I did see that a reference to the DC is being saved in self, and that is a big no-no. If that same DC is being reused on other paint events then you will definitly see the flickering problem, but it looked to me like it was creating a new one for each paint event and replacing the self.DC each time, but I may be missing something. It should be changed to not store the DC, but just pass it as a parameter to each of the methods that needs it.

ยทยทยท

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