def _error_handler(display, event):
# By default, all errors are silently ignored: this has a better chance
# of working than the default behaviour of quitting ;-)
#
# We've actually never seen an error that was our fault; they're always
# driver bugs (and so the reports are useless). Nevertheless, set
# environment variable PYGLET_DEBUG_X11 to 1 to get dumps of the error
# and a traceback (execution will continue).
import pyglet
if pyglet.options['debug_x11']:
event = event.contents
buf = c_buffer(1024)
xlib.XGetErrorText(display, event.error_code, buf, len(buf))
print('X11 error:', buf.value)
print(' serial:', event.serial)
print(' request:', event.request_code)
print(' minor:', event.minor_code)
print(' resource:', event.resourceid)
import traceback
print('Python stack trace (innermost last):')
traceback.print_stack()
return 0
评论列表
文章目录