Permalink
Browse files

Retina display position fix

Adds an if statement for correcting the position of non-fullscreen windows on retina displays.
  • Loading branch information...
jfkominsky authored and peircej committed Apr 17, 2018
1 parent 9b46ff0 commit 0d4538de9b423980d348c515ff6f4617be46ffc1
Showing with 9 additions and 5 deletions.
  1. +9 −5 psychopy/visual/backends/pygletbackend.py
@@ -202,12 +202,16 @@ def __init__(self, win, *args, **kwargs):
self.winHandle.set_mouse_visible(False)
self.winHandle.on_resize = _onResize # avoid circular reference
if not win.pos:
# work out where the centre should be
win.pos = [(thisScreen.width - win.size[0]) / 2,
(thisScreen.height - win.size[1]) / 2]
# work out where the centre should be
if win.useRetina:
win.pos = [(thisScreen.width - win.size[0]/2) / 2,
(thisScreen.height - win.size[1]/2) / 2]
else:
win.pos = [(thisScreen.width - win.size[0]) / 2,
(thisScreen.height - win.size[1]) / 2]
if not win._isFullScr:
# add the necessary amount for second screen
self.winHandle.set_location(int(win.pos[0] + thisScreen.x),
print(win.size[0])
self.winHandle.set_location(int(win.pos[0] + thisScreen.x),
int(win.pos[1] + thisScreen.y))
try: # to load an icon for the window

0 comments on commit 0d4538d

Please sign in to comment.