X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/70a357c256c261f5a623af20ef72b8a3dbf159a4..bd76e17e0f94ccb5459d0510b0234237aa2060f7:/wxPython/demo/wxDragImage.py diff --git a/wxPython/demo/wxDragImage.py b/wxPython/demo/wxDragImage.py index 7ab24df8b9..5fcecb0d53 100644 --- a/wxPython/demo/wxDragImage.py +++ b/wxPython/demo/wxDragImage.py @@ -9,14 +9,14 @@ class DragShape: def __init__(self, bmp): self.bmp = bmp self.pos = wxPoint(0,0) - self.shown = true + self.shown = True self.text = None - self.fullscreen = false + self.fullscreen = False def HitTest(self, pt): rect = self.GetRect() - return rect.Inside(pt.x, pt.y) + return rect.InsideXY(pt.x, pt.y) def GetRect(self): @@ -31,11 +31,11 @@ class DragShape: dc.Blit(self.pos.x, self.pos.y, self.bmp.GetWidth(), self.bmp.GetHeight(), - memDC, 0, 0, op, true) + memDC, 0, 0, op, True) - return true + return True else: - return false + return False @@ -58,7 +58,7 @@ class DragCanvas(wxScrolledWindow): bmp = images.getTestStarBitmap() shape = DragShape(bmp) shape.pos = wxPoint(5, 5) - shape.fullscreen = true + shape.fullscreen = True self.shapes.append(shape) @@ -185,7 +185,7 @@ class DragCanvas(wxScrolledWindow): # reposition and draw the shape self.dragShape.pos = self.dragShape.pos + evt.GetPosition() - self.dragStartPos - self.dragShape.shown = true + self.dragShape.shown = True self.dragShape.Draw(dc) self.dragShape = None @@ -207,7 +207,7 @@ class DragCanvas(wxScrolledWindow): # erase the shape since it will be drawn independently now dc = wxClientDC(self) - self.dragShape.shown = false + self.dragShape.shown = False self.EraseShape(self.dragShape, dc) @@ -228,16 +228,16 @@ class DragCanvas(wxScrolledWindow): # if we have shape and image then move it, posibly highlighting another shape. elif self.dragShape and self.dragImage: onShape = self.FindShape(evt.GetPosition()) - unhiliteOld = false - hiliteNew = false + unhiliteOld = False + hiliteNew = False # figure out what to hilite and what to unhilite if self.hiliteShape: if onShape is None or self.hiliteShape is not onShape: - unhiliteOld = true + unhiliteOld = True if onShape and onShape is not self.hiliteShape and onShape.shown: - hiliteNew = TRUE + hiliteNew = True # if needed, hide the drag image so we can update the window if unhiliteOld or hiliteNew: @@ -274,3 +274,10 @@ def runTest(frame, nb, log): overview = """\ """ + + +if __name__ == '__main__': + import sys,os + import run + run.main(['', os.path.basename(sys.argv[0])]) +