X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/95bfd958bda8955ac81277c78e5627c926154f39..60e424abd6a8a65837cda8fa98eee592a5da2678:/wxPython/demo/OGL.py diff --git a/wxPython/demo/OGL.py b/wxPython/demo/OGL.py index 3e3ac4e80d..32df0612ec 100644 --- a/wxPython/demo/OGL.py +++ b/wxPython/demo/OGL.py @@ -2,11 +2,6 @@ # # o Updated for wx namespace # -# 11/30/2003 - Jeff Grimmett (grimmtooth@softhome.net) -# -# o OGL's busted bigtime. Can't even use OGLInitialize() without a -# program error on w2k. -# import wx import wx.ogl as ogl @@ -15,11 +10,6 @@ import images ##wx.Trap() -#---------------------------------------------------------------------- -# This creates some pens and brushes that the OGL library uses. - -ogl.OGLInitialize() - #---------------------------------------------------------------------- class DiamondShape(ogl.PolygonShape): @@ -254,7 +244,7 @@ class TestWindow(ogl.ShapeCanvas): # for some reason, the shapes have to be moved for the line to show up... fromShape.Move(dc, fromShape.GetX(), fromShape.GetY()) - wx.EVT_WINDOW_DESTROY(self, self.OnDestroy) + self.Bind(wx.EVT_WINDOW_DESTROY, self.OnDestroy) def MyAddShape(self, shape, x, y, pen, brush, text): @@ -308,12 +298,14 @@ def runTest(frame, nb, log): #---------------------------------------------------------------------- +# The OGL library holds some resources that need to be freed before +# the app shuts down. class __Cleanup: - cleanup = ogl.OGLCleanUp - def __del__(self): - self.cleanup() + def __del__(self, cleanup=ogl.OGLCleanUp): + cleanup() -# when this module gets cleaned up then wx.OGLCleanUp() will get called +# When this module gets cleaned up by Python then __cu will be cleaned +# up and it's __dell__ is called, which will then call ogl.OGLCleanUp. __cu = __Cleanup() @@ -326,5 +318,5 @@ manipulation of simple and complex graphic images on a canvas. if __name__ == '__main__': import sys,os import run - run.main(['', os.path.basename(sys.argv[0])]) + run.main(['', os.path.basename(sys.argv[0])] + sys.argv[1:])