moderngl-window
A cross platform helper library for ModernGL making window creation and resource loading simple
What it is and what it does
moderngl-window is a cross-platform utility library that abstracts away the complexity of setting up OpenGL windows and loading graphics resources. It sits on top of ModernGL and provides a unified interface for creating windows using your choice of backend (pyglet, pygame, GLFW, SDL2, PySide2, PyQt5, or tkinter), handling keyboard and mouse events consistently across platforms. The library also bundles loaders for 2D textures, texture arrays, cube maps, GLSL shaders, and 3D models in OBJ, GLTF 2.0, and STL formats.
The design emphasizes flexibility: you can use the simple WindowConfig class to get started immediately, or drop down to lower-level APIs for fine-grained control. It depends on moderngl for the core rendering, pyglet for windowing, numpy and pyglm for math operations, and Pillow for image loading. The package is actively maintained, supports Python 3.9 and later, and has been tested on Windows, Linux, and macOS.
Use it for:
- Build a cross-platform 3D visualization tool that works identically on Windows, Linux, and macOS without rewriting window code.
- Prototype interactive graphics applications using ModernGL without manually handling platform-specific windowing details.
- Load and render 3D models and textures from common formats (OBJ, GLTF, STL, PNG, JPEG) with minimal boilerplate.
- Create educational graphics demos or scientific visualizations that need consistent event handling across multiple windowing systems.
- Develop games or interactive applications using a pluggable architecture that lets you swap windowing backends at runtime.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
moderngl-window simplifies OpenGL window creation and resource loading across Windows, Linux, and macOS by wrapping ModernGL with support for multiple windowing backends and built-in loaders for textures, shaders, and 3D models.
Yes. The package is actively maintained, has no known vulnerabilities, installs with low friction, and solves a genuine cross-platform pain point for OpenGL development. It is well-suited for anyone building 3D graphics applications with ModernGL who wants to avoid reimplementing window management and resource loading for each platform.
Install
moderngl-window on PyPI
pip
pip install moderngl-windowuv
uv add moderngl-windowpoetry
poetry add moderngl-windowInstalling moderngl-window
Before you install
Low install friction with a pure-Python wheel distribution. The package is actively maintained with a recent commit on 2026-07-11 and draws on five runtime dependencies (moderngl, pyglet, numpy, pyglm, Pillow) that are themselves well-established.
License in practice
Licensed under the MIT License (permissive), allowing use in commercial and private projects with minimal restrictions.
Quickstart
pip install moderngl-window
import moderngl_window as mglw
class Test(mglw.WindowConfig):
gl_version = (3, 3)
def on_render(self, time: float, frametime: float):
self.ctx.clear(1.0, 0.0, 0.0, 0.0)
Test.run()
Requires a working OpenGL context; windowing backend (pyglet, pygame, GLFW, SDL2, PySide2, PyQt5, or tkinter) must be installed separately or specified at runtime.
Verify before relying
- Whether all advertised windowing backends (pygame, GLFW, SDL2, PySide2, PyQt5, tkinter) are included as optional dependencies or must be installed separately.
- Performance characteristics and typical use cases for large-scale 3D scene rendering or real-time graphics applications.
Package facts
| License | not declared (permissive) |
| Python support | supports the current Python release (>=3.9) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 5 — moderngl, pyglet, numpy, pyglm, Pillow |
| Maintenance | actively maintained — 572 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 216,278/month — #9,383 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: moderngl_window-3.1.1-py3-none-any.whl
Tags
More Graphics packages
Pillow adds image processing capabilities to…
permissive · top 100 on PyPI
fonttoolsfonttools manipulates font files in multiple…
permissive · top 1,000 on PyPI
matplotlib-inlineEnables matplotlib figures to display inline…
permissive · top 1,000 on PyPI
pymupdfPyMuPDF extracts, renders, converts, and…
agpl · top 1,000 on PyPI
pypdfium2pypdfium2 is a Python binding to PDFium that…
permissive · top 1,000 on PyPI
altairAltair is a declarative Python library for…
permissive · top 1,000 on PyPI
glcontextProvides portable OpenGL context creation…
permissive · top 15,000 on PyPI
modernglModernGL is a Python wrapper over OpenGL Core…
permissive · top 15,000 on PyPI
rendercanvasRendercanvas provides a unified canvas API that…
unclear · top 15,000 on PyPI
glfwPython bindings for GLFW 3 that wrap the C…
permissive · top 5,000 on PyPI
PyOpenGLPyOpenGL provides standard OpenGL bindings for…
permissive · top 5,000 on PyPI
pygletpyglet is a cross-platform windowing and…
unclear · top 5,000 on PyPI
wgpuwgpu-py provides a Python binding to WebGPU, a…
permissive · top 15,000 on PyPI
pyglmPyGLM provides Python bindings to OpenGL…
permissive · top 15,000 on PyPI
PyOpenGL-accelerateProvides Cython-compiled C extensions that…
permissive · top 5,000 on PyPI
panda3d-simplepbrProvides a physically-based rendering (PBR)…
permissive · top 15,000 on PyPI