def inputhook_glut():
 signal.signal(signal.SIGINT, glut_int_handler)
 try:
  t = clock()
  if (glut.glutGetWindow() == 0):
   glut.glutSetWindow(1)
   glutMainLoopEvent()
   return 0
  while (not stdin_ready()):
   glutMainLoopEvent()
   used_time = (clock() - t)
   if (used_time > 10.0):
    time.sleep(1.0)
   elif (used_time > 0.1):
    time.sleep(0.05)
   else:
    time.sleep(0.001)
 except KeyboardInterrupt:
  pass
 return 0

def inputhook_glut ( ) : signal . signal ( signal . SIGINT , glut_int_handler ) try : t = clock ( ) if ( glut . glutGetWindow ( ) == 0 ) : glut . glutSetWindow ( 1 ) glutMainLoopEvent ( ) return 0 while ( not stdin_ready ( ) ) : glutMainLoopEvent ( ) used_time = ( clock ( ) - t ) if ( used_time > 10.0 ) : time . sleep ( 1.0 ) elif ( used_time > 0.1 ) : time . sleep ( 0.05 ) else : time . sleep ( 0.001 ) except KeyboardInterrupt : pass return 0
run the pyglet event loop by processing pending events only .