Skip to content

Add workaround for Pyglet 2.1 DPI scaling issues#2377

Open
azhuchkov wants to merge 1 commit into3b1b:masterfrom
azhuchkov:dpi-scaling-fix
Open

Add workaround for Pyglet 2.1 DPI scaling issues#2377
azhuchkov wants to merge 1 commit into3b1b:masterfrom
azhuchkov:dpi-scaling-fix

Conversation

@azhuchkov
Copy link
Copy Markdown
Contributor

@azhuchkov azhuchkov commented Aug 5, 2025

Motivation

This update resolves a backward compatibility issue introduced in Pyglet 2.1, where the new default DPI settings may lead to incorrect window sizing and positioning on HiDPI displays. (Pyglet 2.1 is automatically used as a default backend in moderngl_window)

Proposed Changes

  • A “Troubleshooting” section in README.md that documents the new PYGLET_DPI_SCALING environment variable. Users can set it to scaled or stretch to restore expected behavior.
  • Support code in manimlib/window.py to read PYGLET_DPI_SCALING at startup and apply it to pyglet.options.dpi_scaling (if available). A stderr warning is emitted when running against older Pyglet versions that lack this option.

This should allow to restore prior DPI behavior without requiring a downgrade or switching default value, which requires rigorous testing.

@azhuchkov
Copy link
Copy Markdown
Contributor Author

Link to the introduction of the new DPI scaling feature.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant