You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm working with screeninfo + pyautogui. My code was working fine on Windows, but when I moved to MacOS, I noticed it would only work in my primary monitor (where y=0), not in other monitors. Pyautogui would move the cursor to the wrong coordinates.
The reason:
In Windows (and probably Linux), mon.y is the position of the top of the monitor mon relative to the top of the primary monitor. Above primary monitor is negative, below is positive*.
In MacOS, mon.y is the position of the bottom of the monitor mon relative to the bottom of the primary monitor. Above primary monitor is positive, below is negative*.
* I think. I'm only submitting the issue today, but I encountered this issue months ago when I actually had an external monitor. My memory might be wrong, and I don't have another monitor anymore to confirm.
Pyautogui uses the Windows' meaning of y in all systems (afaik). I looked into pyautogui's code, but it doesn't seem to make any computations on y, it just passes it straight to the "internal" (Quartz) functions. It uses Quartz underneath though, and I didn't check what Quartz does.
Unsure which approach you'd rather take here. Add another field to Monitor for this y? Add a @property? Add some documentation explaining this distinction in semantics?
The text was updated successfully, but these errors were encountered:
I'm working with screeninfo + pyautogui. My code was working fine on Windows, but when I moved to MacOS, I noticed it would only work in my primary monitor (where y=0), not in other monitors. Pyautogui would move the cursor to the wrong coordinates.
The reason:
mon.y
is the position of the top of the monitormon
relative to the top of the primary monitor. Above primary monitor is negative, below is positive*.mon.y
is the position of the bottom of the monitormon
relative to the bottom of the primary monitor. Above primary monitor is positive, below is negative*.* I think. I'm only submitting the issue today, but I encountered this issue months ago when I actually had an external monitor. My memory might be wrong, and I don't have another monitor anymore to confirm.
Pyautogui uses the Windows' meaning of y in all systems (afaik). I looked into pyautogui's code, but it doesn't seem to make any computations on
y
, it just passes it straight to the "internal" (Quartz) functions. It uses Quartz underneath though, and I didn't check what Quartz does.I ended up solving my problem with:
Unsure which approach you'd rather take here. Add another field to
Monitor
for this y? Add a@property
? Add some documentation explaining this distinction in semantics?The text was updated successfully, but these errors were encountered: