[PyOpenGL-Users] name 'Opengl' is not defined
Brought to you by:
mcfletch
From: George B. <br...@ve...> - 2008-02-27 17:19:37
|
Still new at this, especially graphics. I'm working on a 3d graphics project, and found nice samples for mat3D.py, which is available from http://www.scipy.org/WilnaDuToit. The program includes this code: """OpenGL-based 3d surface plot""" #last updated 12/10/2006 from OpenGL.GL import * from OpenGL.GLUT import * from OpenGL.Tk import * import Tkinter import numpy as N import tkFileDialog -snip- def make_plot(self,colors = Colors): """Draw a plot in a Tk OpenGL render window.""" # Some api in the chain is translating the keystrokes to this octal string # so instead of saying: ESCAPE = 27, we use the following. ESCAPE = '\033' # Number of the glut window. window = 0 # Create render window (tk) f = Tkinter.Frame() f.pack(side = 'top') self.offset = 0.05 self.textlength,self.xticks,self.yticks,self.zticks =self.GetFormatMaxTextLength() #todo: each tick own offset o = Opengl(width = 640, height = 480, double = 1, depth = 1) o.redraw = self.redraw -snip- which yields the following error: Traceback (most recent call last): File "/home/browerg/text.py", line 35, in <module> o = Opengl(None, width = 400, height = 200, double = 1, depth = 1) NameError: name 'Opengl' is not defined Searching the web led me to text.py at http://www.koders.com/python/fid02D8AE6DDE1B87CF36E3766500C78F05AAF6C31C.aspx?s=tkinter#L33. The program includes this code: #!/usr/bin/env python from OpenGL.GL import * from OpenGL.Tk import * from logo import * -snip- import Tkinter, sys o = Opengl(None, width = 400, height = 200, double = 1, depth = 1) -snip- which gave the same error: Traceback (most recent call last): File "/home/browerg/text.py", line 35, in <module> o = Opengl(None, width = 400, height = 200, double = 1, depth = 1) NameError: name 'Opengl' is not defined I'm running Python2.5, Tk8.4, and Tcl8.4 on Ubuntu 7.10. Hardware is an i686 laptop. What am I missing? Thanks in advance. George |