views:

137

answers:

2
+2  A: 

You can bind a method to handle wx.EVT_SIZE or the panel and invalidate it there. Alternatively simply use the wx.FULL_REPAINT_ON_RESIZE for the panel.

mghie
A: 

The documentation for a SizeEvent claims that there may be some complications when drawing depends on the dimensions of the window. I do not know exactly what is going on behind the scenes. I followed the suggestion on the link and added the call self.Refresh() to the top of onPaint() and this seems to give the desired behavior. See mghie's answer for a more efficient example of working code.

Derek E
That way every paint action causes a new one. Do you get 100% processor load?
mghie
No I don't, but I shouldn't need to rethrow a paint event. :P (just read the doc for wx.Window.Refresh() and saw that it throws a paint event, too). I was more trying to point in the direction as to why it's happening.
Derek E