3b1b/manim

`window.focus()` offsets the window position

Opened this issue · 1 comments

In #2241, I've added a new focus() command via these lines. Then in this commit, 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() method didn't have any effects for me. That's why I did a simple

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 to track this issue.

Thanks for the partial fix via #2274, at least the window doesn't jump around now when I use reload() (but of course doesn't get focus either, but this is a better state than beforehand). Hopefully, the team at pyglet will find a solution such that focus() works properly.