From 6b4b24eee9d29279d02157bf477dd431d468ad16 Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Tue, 8 May 2007 02:44:48 +0000 Subject: [PATCH] Avoid using wx.ClientDC git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@45877 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- wxPython/demo/DragImage.py | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/wxPython/demo/DragImage.py b/wxPython/demo/DragImage.py index d8f7ef3458..d0173caf03 100644 --- a/wxPython/demo/DragImage.py +++ b/wxPython/demo/DragImage.py @@ -136,19 +136,11 @@ class DragCanvas(wx.ScrolledWindow): return shape return None - # Remove a shape from the display - def EraseShape(self, shape, dc): - r = shape.GetRect() - dc.SetClippingRect(r) - self.TileBackground(dc) - self.DrawShapes(dc) - dc.DestroyClippingRegion() # Clears the background, then redraws it. If the DC is passed, then # we only do so in the area so designated. Otherwise, it's the whole thing. def OnEraseBackground(self, evt): dc = evt.GetDC() - if not dc: dc = wx.ClientDC(self) rect = self.GetUpdateRegion().GetBox() @@ -231,11 +223,11 @@ class DragCanvas(wx.ScrolledWindow): if dx <= tolerance and dy <= tolerance: return - # erase the shape since it will be drawn independently now - dc = wx.ClientDC(self) + # refresh the area of the window where the shape was so it + # will get erased. self.dragShape.shown = False - self.EraseShape(self.dragShape, dc) - + self.RefreshRect(self.dragShape.GetRect(), True) + self.Update() if self.dragShape.text: self.dragImage = wx.DragString(self.dragShape.text,