from wxPython.wx import *
try:
from wxPython.glcanvas import *
- haveGLCanvas = true
+ haveGLCanvas = True
except ImportError:
- haveGLCanvas = false
+ haveGLCanvas = False
try:
# The Python OpenGL package can be found at
# http://PyOpenGL.sourceforge.net/
from OpenGL.GL import *
from OpenGL.GLUT import *
- haveOpenGL = true
+ haveOpenGL = True
except ImportError:
- haveOpenGL = false
+ haveOpenGL = False
#----------------------------------------------------------------------
box.Add(btn, 0, wxALIGN_CENTER|wxALL, 15)
EVT_BUTTON(self, k, self.OnButton)
- self.SetAutoLayout(true)
+ #** Enable this to show putting a wxGLCanvas on the wxPanel
+ if 0:
+ c = CubeCanvas(self)
+ c.SetSize((200, 200))
+ box.Add(c, 0, wxALIGN_CENTER|wxALL, 15)
+
+ self.SetAutoLayout(True)
self.SetSizer(box)
+
def OnButton(self, evt):
canvasClassName = buttonDefs[evt.GetId()][0]
canvasClass = eval(canvasClassName)
frame = wxFrame(None, -1, canvasClassName, size=(400,400))
canvas = canvasClass(frame)
- frame.Show(true)
+ frame.Show(True)
class MyCanvasBase(wxGLCanvas):
def __init__(self, parent):
wxGLCanvas.__init__(self, parent, -1)
- self.init = false
+ self.init = False
# initial mouse position
self.lastx = self.x = 30
self.lasty = self.y = 30
self.SetCurrent()
if not self.init:
self.InitGL()
- self.init = true
+ self.init = True
self.OnDraw()
def OnMouseDown(self, evt):
if evt.Dragging() and evt.LeftIsDown():
self.x, self.y = self.lastx, self.lasty
self.x, self.y = evt.GetPosition()
- self.Refresh(false)
+ self.Refresh(False)
frame = wxFrame(None, -1, "GL Demos", wxDefaultPosition, wxSize(600,300))
#win = ConeCanvas(frame)
MySplitter(frame)
- frame.Show(TRUE)
+ frame.Show(True)
self.SetTopWindow(frame)
- return TRUE
+ return True
app = MyApp(0)
app.MainLoop()