`window.focus()` offsets the window position
- Vorherrschende Sprache
- Python
- Sterne
- 93.8k
- Forks
- 7.7k
- PR-Merge-Kennzahlen
- PR-Kennzahlen ausstehend
Beschreibung
In #2241, I've added a new `focus()` command [via these lines](https://github.com/3b1b/manim/blob/744e695340c5691551f2650d99db71964cb292c7/manimlib/window.py#L98-L110). Then in [this commit](https://github.com/3b1b/manim/commit/185f6428264f25dcdbd4faeb6062dbc75d8b1ed9), 3b1b decided to `focus()` the window every time on initialization, i.e. also when the new `reload()` command is used.
The problem is that I had to use a workaround in that `focus()` command since the pyglet [`activate()`](https://pyglet.readthedocs.io/en/latest/modules/window.html#pyglet.window.Window.activate) method didn't have any effects for me. That's why I did a simple
```py
self._window.set_visible(False)
self._window.set_visible(True)
```
This consistently restores focus on the window, however it also offsets its position for me, which is quite annoying as the window might even jump around when reaching the corners of the screen.
> [!tip]
> I've opened a new issue on the pyglet repo [here](https://github.com/pyglet/pyglet/issues/1244) to track this issue.
Beitragsleitfaden
Für dieses Repository ist kein Beitragsleitfaden indexiert
Bewertung
Dieses Issue wurde noch nicht bewertet.