Skip to content

cannot import name 'OpenGLFrame' from 'pyopengltk' | MacOS | #12

Open
@ajh123

Description

@ajh123

@jonwright , @einarf
Im running Python 3.7.3 on macOS Catalina, I tried to import the OpenGLFrame like this

from OpenGL import GL
from pyopengltk import OpenGLFrame

Which resulted in this error
cannot import name 'OpenGLFrame' from 'pyopengltk'

Edit: after that i tried to make a frame like this

class AppOgl(OpenGLFrame):

	def initgl(self):
		"""Initalize gl states when the frame is created"""
		GL.glViewport(0, 0, self.width, self.height)
		GL.glClearColor(0.0, 1.0, 0.0, 0.0)    
		self.start = time.time()
		self.nframes = 0

	def redraw(self):
		"""Render a single frame"""
		GL.glClear(GL.GL_COLOR_BUFFER_BIT)
		tm = time.time() - self.start
		self.nframes += 1
		print("fps",self.nframes / tm, end="\r" )


if __name__ == '__main__':
	root = tkinter.Tk()
	app = AppOgl(root, width=320, height=200)
	app.pack(fill=tkinter.BOTH, expand=tkinter.YES)
	app.animate = 1
	app.after(100, app.printContext)
	app.mainloop()

Edit 2 :
Which still resulted in this error
cannot import name 'OpenGLFrame' from 'pyopengltk'

Edit 3: I used pip to install this

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions