推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
stone000
V2EX  ›  Python

[求助] Pyautogui 不同屏幕分辨率處理

  •  
  •   stone000 · Dec 11, 2020 · 2285 views
    This topic created in 1978 days ago, the information mentioned may be changed or developed.
    Pyautogui 不同屏幕分辨率我是用以下方法,但是結果不准,還有其他方法嗎?
    先獲取當前屏幕分辨率,再跟原始 1440*900 對比,求出相應比例,然後所有用到坐標的地方乘以這個比例

    import pyautogui as ag
    import time
    import os

    while True:
    oldX, oldY = ag.position()
    time.sleep(0.3)
    nowX, nowY = ag.position()

    if nowX!=oldX or nowY!=oldY:
    os.system('cls')
    print(nowX,nowY)
    ClericPy
        1
    ClericPy  
       Dec 11, 2020
    我定位都是以图搜坐标, 只要保证缩放比一致就没出过问题, 偶尔要加个容错率... 只要用除法肯定有误差

    早年间用 ahk, 现在 pyautogui 也用过(似乎就是截图在内存里 pillow 定位)

    直接看你代码实在没看出来你要做啥
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3402 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 66ms · UTC 12:14 · PVG 20:14 · LAX 05:14 · JFK 08:14
    ♥ Do have faith in what you're doing.