[PyOpenGL-Users] tk animation
Brought to you by:
mcfletch
From: altern <al...@gm...> - 2006-10-18 11:16:26
|
hi i am trying to get an animated opengl drawing under Tk but i dont get it right. I am using the after() function to call the Opengl instance's redraw function This is more or less what i do: from OpenGL.Tk import * class App: def __init__(self): self.glcanvas = Opengl(width=800, height=600, double=1) self.glcanvas.redraw = self.draw self.glcanvas.pack(side='top', expand=1, fill='both') def draw(self, event=None): self.glcanvas.activate() self.render() # opengl stuff goes here self.glcanvas.tkExpose() # redraw self.glcanvas.after(30, self.glcanvas.redraw) def render(self): # clean background, draw, swap buffers etc... pass So far I am getting a stack overflow : File "/usr/lib/python2.4/site-packages/OpenGL/Tk/__init__.py", line 492 in tkRedraw glPushMatrix() GLerror: [Errno 1283] stack overflow Probably i am confused with what to put inside the redraw() function and the how to use the after(). I have been trying to find examples of animations with Tk but could not find any. Also could not find much information online specifically about using tk with opengl so i am using help(OpenGL.Tk) as main source of info. It would be nice to have some other resource if anyone suggest one. thanks enrike |