[wxPython-users] Can't clear Clipping region in PaintDC

Christopher Barker Chris.Barker at noaa.gov
Mon Oct 23 11:33:05 PDT 2006


Thanks Robin (and Paul)

Robin Dunn wrote:
> It's not a clipping region, but an update region,

Ahh! perhaps an editing of the docs is in order:

"""
Using wxPaintDC within OnPaint is important because it automatically 
sets the clipping area to the damaged area of the window. Attempts to 
draw outside this area do not appear.
"""

That text used the term Clipping, so that's where I was looking...

> As Paul mentioned you can get the update region, and convert it to a 
> rectangle that encloses all of the region with:
> 
>     rgn = self.GetUpdateRegion()
>     box = rgn.GetBox()

Is there a way to set the Update Region?

> If you want to always paint the whole window after resize events then 
> you can use the wx.FULL_REPAINT_ON_RESIZE style when creating the window.

That's the solution I've chosen. Which brings up:

Is there a clean way to pass through all the style flags, while adding 
one? I've done this, but it just feels like too much code for Python:

class ScaleWindow(wx.Panel):
     def __init__(self, Colormap, *args, **kwargs):
         flags = kwargs.get('style', 0)
         flags |= wx.FULL_REPAINT_ON_RESIZE
         kwargs['style'] = flags

         wx.Panel.__init__(self, *args, **kwargs)


I looked for a AddStyle() method in wx.Window, but didn't find one.

-Chris


-- 
Christopher Barker, Ph.D.
Oceanographer
                                     		
NOAA/OR&R/HAZMAT         (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

Chris.Barker at noaa.gov




More information about the wxpython-users mailing list