[wxPython-users] wxmpl and refresh problem

Werner F. Bruhin werner.bruhin at free.fr
Fri May 4 03:56:30 PDT 2007


Hi Massimiliano,

Massimiliano Costacurta wrote:
> ...
> If you run the program you'll see that the crosshair "dirties" the 
> plot. I've got the same trouble if I reduce the window to icon and 
> then maximize it. I suppose this is due to a refresh problem, but I 
> don't know how I can solve it. I even took a look to the code of 
> wxmpl.py and the only thing I found was that there is a 
> "onEraseBackgroundMethod" method which is not overridden. Does it deal 
> with the problem? Can anyone help me?
I do see this problem too, but only if the mouse pointer is within plot 
area when the application starts.  I.e. start it and make sure your 
mouse pointer is in an area which will not be covered by your frame, 
then move the mouse pointer into it and the cross hair are showing 
correctly and are getting removed when one moves the mouse pointer out 
of the frame.

However if you have the mouse pointer already in the area the 
application will use then it seems that the "first" cross hair stays 
around for ever.

But I can't figure out where the crosshair should be cleared - I am sure 
Ken will know ;-) .

When I close the frame/app I get a PyDeadObjectError exception in wxmpl.py.

Possible fix is to put a try/except into OnActivate:
    def OnActivate(self, evt):
        """
        Handles the wxPython window activation event.
        """
        if not evt.GetActive():
            try:
                self.cursor.setNormal()
                self.location.clear()
                self.crosshairs.clear()
                self.rubberband.clear()
            except wx.PyDeadObjectError:
                pass
        evt.Skip()

Werner




More information about the wxpython-users mailing list