pyglet includes a number of debug paths that can be enabled during or before application startup. These were primarily developed to aid in debugging pyglet itself, however some of them may also prove useful for understanding and debugging pyglet applications.
Each debug option is a key in the pyglet.options dictionary. Options can be set directly on the dictionary before any other modules are imported:
import pyglet pyglet.options['debug_gl'] = False
They can also be set with environment variables before pyglet is imported. The corresponding environment variable for each option is the string PYGLET_ prefixed to the uppercase option key. For example, the environment variable for debug_gl is PYGLET_DEBUG_GL. Boolean options are set or unset with 1 and 0 values.
A summary of the debug environment variables appears in the table below.
Option Environment variable Type debug_font PYGLET_DEBUG_FONT bool debug_gl PYGLET_DEBUG_GL bool debug_gl_trace PYGLET_DEBUG_GL_TRACE bool debug_gl_trace_args PYGLET_DEBUG_GL_TRACE_ARGS bool debug_graphics_batch PYGLET_DEBUG_GRAPHICS_BATCH bool debug_lib PYGLET_DEBUG_LIB bool debug_media PYGLET_DEBUG_MEDIA bool debug_trace PYGLET_DEBUG_TRACE bool debug_trace_args PYGLET_DEBUG_TRACE_ARGS bool debug_trace_depth PYGLET_DEBUG_TRACE_DEPTH int debug_win32 PYGLET_DEBUG_WIN32 bool debug_x11 PYGLET_DEBUG_X11 bool graphics_vbo PYGLET_GRAPHICS_VBO bool
The debug_media and debug_font options are used to debug the pyglet.media and pyglet.font modules, respectively. Their behaviour is platform-dependent and useful only for pyglet developers.
The remaining debug options are detailed below.