Skip to content

Error switching into fullscreen mode using Pyglet backend #223

@azhuchkov

Description

@azhuchkov

Running the following file with the command python test.py --window pyglet

#test.py

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()

and then switching into fullscreen by pressing F11, I get only bottom left quarter of the screen red (the rest is black) and sometimes the following error (full output listed):

2025-08-02 01:38:30,046 - moderngl_window - INFO - Attempting to load window class: moderngl_window.context.pyglet.Window
2025-08-02 01:38:30.503 Python[73067:10459058] ApplePersistenceIgnoreState: Existing state will not be touched. New state will be written to /var/folders/dx/jsdfsdfsdfsdqd8qkymk79dzv940000gn/T/org.python.python.savedState
2025-08-02 01:38:30,595 - moderngl_window.context.base.window - INFO - Context Version:
2025-08-02 01:38:30,595 - moderngl_window.context.base.window - INFO - ModernGL: 5.12.0
2025-08-02 01:38:30,595 - moderngl_window.context.base.window - INFO - vendor: Intel Inc.
2025-08-02 01:38:30,595 - moderngl_window.context.base.window - INFO - renderer: Intel Iris Pro OpenGL Engine
2025-08-02 01:38:30,595 - moderngl_window.context.base.window - INFO - version: 4.1 INTEL-18.8.16
2025-08-02 01:38:30,595 - moderngl_window.context.base.window - INFO - python: 3.11.6 (main, Nov  2 2023, 04:51:19) [Clang 14.0.0 (clang-1400.0.29.202)]
2025-08-02 01:38:30,595 - moderngl_window.context.base.window - INFO - platform: darwin
2025-08-02 01:38:30,596 - moderngl_window.context.base.window - INFO - code: 410
2025-08-02 01:38:31.519 Python[73067:10459058] TSM AdjustCapsLockLEDForKeyTransitionHandling - _ISSetPhysicalKeyboardCapsLockLED Inhibit
Exception ignored on calling ctypes callback function: <function ObjCSubclass.method.<locals>.decorator.<locals>.objc_method at 0x10e3f5da0>
Traceback (most recent call last):
  File "/<...>/venv/lib/python3.11/site-packages/pyglet/libs/darwin/cocoapy/runtime.py", line 1503, in objc_method
    result = f(py_self, *args)
             ^^^^^^^^^^^^^^^^^
  File "/<...>/venv/lib/python3.11/site-packages/pyglet/window/cocoa/pyglet_view.py", line 349, in mouseExited_
    x, y = getMousePosition(self, nsevent)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/<...>/venv/lib/python3.11/site-packages/pyglet/window/cocoa/pyglet_view.py", line 74, in getMousePosition
    self._window._mouse_x = x
    ^^^^^^^^^^^^
  File "/<...>/venv/lib/python3.11/site-packages/pyglet/libs/darwin/cocoapy/runtime.py", line 1359, in __getattr__
    raise AttributeError(msg)
AttributeError: ObjCInstance b'PygletView' (140532901398960) has no attribute _window
2025-08-02 01:38:32,797 - moderngl_window - INFO - Duration: 2.08s @ 58.29 FPS

Installed Software

python 3.11.6

moderngl                5.12.0
moderngl-window         3.1.1
pyglet                  2.1.6

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions