skillfed

glfw

A ctypes-based wrapper for GLFW3.

glfw v2.10.2 3.6M downloads/30d#2,563 on PyPI255
Permissive license MIT Active released

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 glfw

uv

uv add glfw

poetry

poetry add glfw

Installing 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

Development Status :: 5 - Production/StableEnvironment :: MacOS XEnvironment :: X11 ApplicationsIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseProgramming Language :: Python :: 2Programming Language :: Python :: 3Topic :: Multimedia :: GraphicsTopic :: Scientific/Engineering :: Visualization

Tags

glfw python bindingswindow creation openglcross-platform windowing libraryglfw3 ctypes wrapperopengl context managementinput handling keyboard mousegraphics window management
openglwindowinggraphics

More Graphics packages