glfw
A ctypes-based wrapper for GLFW3.
What it is and what it does
glfw is a ctypes-based wrapper around GLFW 3, a C library for creating windows, handling input, and managing OpenGL contexts across Windows, macOS, and Linux. It translates the GLFW C API into pythonic function names and replaces low-level constructs (pointers, structs) with Python sequences and namedtuples, making it easier to use from Python code. The package bundles pre-compiled GLFW libraries in wheels for common platforms, though you can override them with custom builds or system libraries via environment variables.
Typical use is to initialize GLFW, create a window with an OpenGL context, then poll events in a render loop while your graphics code draws. It has no runtime dependencies beyond the GLFW library itself (which is bundled), so it's lightweight once installed. Error handling can be configured to report GLFW errors as warnings, exceptions, or log messages, and it supports both the original GLFW naming convention and a pythonic alternative.
Use it for:
- Building 3D graphics applications with OpenGL by managing windows and input events
- Creating cross-platform desktop tools that need windowing and keyboard/mouse input
- Prototyping interactive visualizations or scientific simulations with graphics output
- Wrapping or extending GLFW functionality in Python without writing C bindings yourself
- Running frozen executables (cx_Freeze, PyInstaller) that require windowing on multiple platforms
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Python bindings for GLFW 3 that wrap the C library via ctypes, providing window creation, input handling, and OpenGL context management with a pythonic API.
Yes, if you need to build OpenGL applications or interactive graphics tools in Python. The package is actively maintained, has no known vulnerabilities, uses a permissive license, and pre-built wheels eliminate most installation friction. Medium friction remains due to native library dependencies, but this is inherent to GLFW itself, not the wrapper. Not necessary if you only need 2D graphics or don't require low-level window control.
Install
glfw on PyPI
pip
pip install glfwuv
uv add glfwpoetry
poetry add glfwInstalling glfw
Before you install
Medium install friction due to native library dependencies, but wheels are pre-built for Windows, macOS (Intel and ARM), and Linux (x86_64 and aarch64). Active maintenance with a release 24 days ago.
License in practice
MIT license is permissive; you can use, modify, and distribute this package freely in commercial or private projects with minimal restrictions.
Quickstart
pip install glfw
import glfw
if glfw.init():
window = glfw.create_window(640, 480, "Hello", None, None)
glfw.make_context_current(window)
glfw.terminate()
Requires GLFW shared library; wheels include it for Windows, macOS, and Linux, but custom builds or system libraries may be needed on some platforms. Set PYGLFW_LIBRARY to override the bundled library path.
Verify before relying
- Whether the package supports modern Python versions beyond 2 and 3 (classifiers list both but requires_python is unspecified)
- Performance characteristics and latency for real-time graphics applications
- Compatibility with Wayland on Linux (description mentions detection but not guarantees)
Package facts
| License | MIT (permissive) |
| Python support | not specified |
| Install friction | medium — platform-specific wheel |
| Runtime dependencies | none |
| Maintenance | actively maintained — 24 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 3,602,190/month — #2,563 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: glfw-2.10.2-py2.py3-none-macosx_10_6_intel.whl; glfw-2.10.2-py2.py3-none-macosx_11_0_arm64.whl; glfw-2.10.2-py2.py3-none-manylinux2014_aarch64.whl; glfw-2.10.2-py2.py3-none-manylinux2014_x86_64.whl; glfw-2.10.2-py2.py3-none-manylinux_2_28_aarch64.whl; glfw-2.10.2-py2.py3-none-manylinux_2_28_x86_64.whl; glfw-2.10.2-py2.py3-none-win32.whl; glfw-2.10.2-py2.py3-none-win_amd64.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
PyOpenGLPyOpenGL provides standard OpenGL bindings for…
permissive · top 5,000 on PyPI
moderngl-windowmoderngl-window simplifies OpenGL window…
permissive · top 15,000 on PyPI
glcontextProvides portable OpenGL context creation…
permissive · top 15,000 on PyPI
pyclibraryParses C header files and automates…
permissive · top 15,000 on PyPI
EWMHlibQuery and control window managers that…
permissive · top 15,000 on PyPI
freetype-pyProvides Python bindings to the FreeType font…
permissive · top 5,000 on PyPI
pygletpyglet is a cross-platform windowing and…
unclear · top 5,000 on PyPI
pyglmPyGLM provides Python bindings to OpenGL…
permissive · top 15,000 on PyPI
modernglModernGL is a Python wrapper over OpenGL Core…
permissive · top 15,000 on PyPI
PyGEL3DPyGEL3D provides Python bindings for a C++…
permissive · top 15,000 on PyPI