Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
ajh123 opened this issue May 14, 2020 · 1 comment
Open

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

ajh123 opened this issue May 14, 2020 · 1 comment

Comments

@ajh123
Copy link

ajh123 commented May 14, 2020

@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

@einarf
Copy link
Contributor

einarf commented May 14, 2020

Yep. There is still work ongoing to support OS X for the tk window. I think the version I tried to make was using CGL, but I think I'll have to try again using AGL: #11

Do feel free to give it a go yourself if you need OS X support. A lot can for example be learned from looking at how pyglet uses AGL when creating OS X context.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants