In this project I'm working on, the frame rate is supposed to be 60FPS 
(0.0167 seconds per frame), but it spikes as high as 0.03 seconds per frame 
whenever any input event occurs; it is especially noticeable when using 
on_mouse_drag.  Here is event code I'm using:

def on_mouse_release(x,y,button,modifiers):
    global mousepressed; mousepressed=0
def on_mouse_press(x,y,button,modifiers):
    global mousex, mousey, mousepressed
    mousepressed=button; mousex=x; mousey=y
def on_mouse_drag(x,y,dx,dy,button,modifiers):
    global mousex, mousey, mousepressed
    mousepressed=button; mousex=x; mousey=y
def on_key_press(symbol,modifiers):
    global keypress; keypress=symbol
def on_key_release(symbol,modifiers):
    global keyrelease; keyrelease=symbol


As you can see, these event functions are pretty barebones.

Currently, the main loop constantly utilizes the mouse* variables 
regardless of whether the inputs are triggered.  As of right now, the 
keypress and keyrelease variables are *not* in use anywhere outside of 
these 2 functions, yet they affect the frame rate anyway.  All that being 
said, the problem must exist in the snippet shown.

I tried removing the global definitions, which didn't help.

You received this message because you are subscribed to the Google Groups 
"pyglet-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
To post to this group, send email to
Visit this group at
For more options, visit

Reply via email to