X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/856e03b7538cb74a991ad18a13708583d8712fdd..904a226c2391014b732661d7d9687c92ef511c50:/wxPython/demo/wxOGL.py diff --git a/wxPython/demo/wxOGL.py b/wxPython/demo/wxOGL.py index a13bee893a..0b2af68b53 100644 --- a/wxPython/demo/wxOGL.py +++ b/wxPython/demo/wxOGL.py @@ -60,6 +60,7 @@ class MyEvtHandler(wxShapeEvtHandler): def OnLeftClick(self, x, y, keys = 0, attachment = 0): shape = self.GetShape() + print shape.__class__ canvas = shape.GetCanvas() dc = wxClientDC(canvas) canvas.PrepareDC(dc) @@ -122,7 +123,7 @@ class TestWindow(wxShapeCanvas): self.log = log self.frame = frame - self.SetBackgroundColour(wxWHITE) + self.SetBackgroundColour("LIGHT BLUE") #wxWHITE) self.diagram = wxDiagram() self.SetDiagram(self.diagram) self.diagram.SetCanvas(self) @@ -165,6 +166,7 @@ class TestWindow(wxShapeCanvas): # for some reason, the shapes have to be moved for the line to show up... fromShape.Move(dc, fromShape.GetX(), fromShape.GetY()) + EVT_WINDOW_DESTROY(self, self.OnDestroy) def MyAddShape(self, shape, x, y, pen, brush, text): @@ -188,7 +190,8 @@ class TestWindow(wxShapeCanvas): - def __del__(self): + def OnDestroy(self, evt): + # Do some cleanup for shape in self.diagram.GetShapeList(): if shape.GetParent() == None: shape.SetCanvas(None) @@ -196,6 +199,13 @@ class TestWindow(wxShapeCanvas): self.diagram.Destroy() + def OnBeginDragLeft(self, x, y, keys): + self.log.write("OnBeginDragLeft: %s, %s, %s\n" % (x, y, keys)) + + def OnEndDragLeft(self, x, y, keys): + self.log.write("OnEndDragLeft: %s, %s, %s\n" % (x, y, keys)) + + #---------------------------------------------------------------------- def runTest(frame, nb, log):