Part of that is a known issue with Retina displays. See my old post below. Pyglet has this problem where sometimes it uses actual pixels and sometimes it uses retina ‘points’ (which are 2 normal pixels), and sometimes it multiplies everything by 2 to get from one to the other, but it only does that multiplication for some parts of the window and not others. It’s a mess, I’ve been trying to figure it out for a while with limited success.
The viewPos error I don’t know. It sounds like something is trying to close and re-open the window before it’s created, but I’d have to look at the window code to be sure. Does that part of the code work on Windows?