Python bindings for TheCherno's GLFW fork with custom titlebar support
Project description
glfw-extended
Python bindings for TheCherno's GLFW fork, which adds custom titlebar support for creating borderless windows with custom chrome (commonly used with Dear ImGui).
Installation
pip install glfw-extended
Features
This package extends the standard pyGLFW bindings with:
TITLEBARwindow hint - Set toFalseto remove the titlebar while keeping window borders and shadowset_titlebar_hit_test_callback()- Register a callback to handle titlebar hit testing for custom drag regions
Usage
import glfw_extended as glfw
# Initialize GLFW
if not glfw.init():
raise RuntimeError("Failed to initialize GLFW")
# Create a window without the default titlebar
glfw.window_hint(glfw.DECORATED, glfw.TRUE)
glfw.window_hint(glfw.TITLEBAR, glfw.FALSE)
window = glfw.create_window(1280, 720, "Custom Titlebar", None, None)
# RESIZABLE must be set after window creation for TITLEBAR to take effect
glfw.set_window_attrib(window, glfw.RESIZABLE, glfw.TRUE)
# Set up hit test callback for custom drag region
def titlebar_hit_test(window, x, y, hit):
# Example: top 30 pixels are the custom titlebar
if y < 30:
hit[0] = 1 # This region should act as titlebar (draggable)
else:
hit[0] = 0 # Normal client area
glfw.set_titlebar_hit_test_callback(window, titlebar_hit_test)
# Main loop
while not glfw.window_should_close(window):
glfw.poll_events()
# ... render your custom titlebar with ImGui, etc.
glfw.swap_buffers(window)
glfw.terminate()
Note:
RESIZABLEmust be set toTRUEviaset_window_attrib(after window creation) forTITLEBARto have any effect.
Platform Support
Currently Windows-only (includes pre-built glfw3.dll from TheCherno's fork).
Note on Import Name
This package uses glfw_extended as the import name to avoid conflicts with the standard glfw package. If you want to use it as a drop-in replacement:
import glfw_extended as glfw
Interoperability with pyGLFW
When glfw_extended loads its custom DLL, it automatically sets the PYGLFW_LIBRARY environment variable. This means any subsequent import glfw (regular pyGLFW) will use the same custom DLL:
import glfw_extended # Loads custom DLL, sets PYGLFW_LIBRARY
import glfw # Uses the same custom DLL via PYGLFW_LIBRARY
# Both modules now use TheCherno's GLFW fork!
# glfw.TITLEBAR won't exist, but the underlying library supports it
This is useful if you have dependencies that import regular glfw but you want them to use the extended functionality.
Credits
- pyGLFW by Florian Rhiem - Original Python bindings (MIT License)
- TheCherno's GLFW fork - GLFW with titlebar support (zlib License)
- GLFW - Original library (zlib License)
License
MIT License (same as pyGLFW). See LICENSE for details.
The bundled GLFW DLL is licensed under the zlib license.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file glfw_extended-0.1.0.tar.gz.
File metadata
- Download URL: glfw_extended-0.1.0.tar.gz
- Upload date:
- Size: 561.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7fcba30ba6eda4a074c5f80eb5432ef457b8f9d12b5eb54f1e8b565e3758ebc2
|
|
| MD5 |
104bb8385acdc004784689166e0a6464
|
|
| BLAKE2b-256 |
bd8696660e01fe7657d559b371f180077dddda17f611979a3991eb03c1cfe8d4
|
Provenance
The following attestation bundles were made for glfw_extended-0.1.0.tar.gz:
Publisher:
publish.yml on Azaias/glfw-extended
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
glfw_extended-0.1.0.tar.gz -
Subject digest:
7fcba30ba6eda4a074c5f80eb5432ef457b8f9d12b5eb54f1e8b565e3758ebc2 - Sigstore transparency entry: 780564789
- Sigstore integration time:
-
Permalink:
Azaias/glfw-extended@49fe9883f10e21295fc5b2c288515c31f0a9c80f -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/Azaias
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@49fe9883f10e21295fc5b2c288515c31f0a9c80f -
Trigger Event:
release
-
Statement type:
File details
Details for the file glfw_extended-0.1.0-py3-none-any.whl.
File metadata
- Download URL: glfw_extended-0.1.0-py3-none-any.whl
- Upload date:
- Size: 561.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0f26b26964cf737e97c906ec4f5657c4a39aa3063de165eff5fce643ef4ccf27
|
|
| MD5 |
27cf22c9943ccfc6a88304024b468d7a
|
|
| BLAKE2b-256 |
8ade537eb1056af3d2a8bff9f5e8d5a75d629906291bf9751c7d24734783ba6c
|
Provenance
The following attestation bundles were made for glfw_extended-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on Azaias/glfw-extended
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
glfw_extended-0.1.0-py3-none-any.whl -
Subject digest:
0f26b26964cf737e97c906ec4f5657c4a39aa3063de165eff5fce643ef4ccf27 - Sigstore transparency entry: 780564792
- Sigstore integration time:
-
Permalink:
Azaias/glfw-extended@49fe9883f10e21295fc5b2c288515c31f0a9c80f -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/Azaias
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@49fe9883f10e21295fc5b2c288515c31f0a9c80f -
Trigger Event:
release
-
Statement type: