New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GetWindowRect和GetClientRect获取窗口坐标错误 #11
Comments
第二张也不对 正确的是无外边框纯内容 466x828 大小的 日志发一下 我没用 python 3.9 测试过 不知道是不是这个问题 |
INFO [2021-06-01 10:31:25]:auto_derby.window:58: width=466 height=828 |
在这个页面这样显示是正常的 育成需要你手动选完卡进去之后才能自动 |
我也这样试过,但是问题是screenshot得到的图片是不正确的,识别不到按钮 |
是不是因为你游戏画面没全部显示在屏幕里 我看你任务栏挡住了 我双屏都没问题 这个直接调用的是windows自己的API 应该不大可能出错 |
第一张图的尺寸是对的 要不然就是 PIL.ImageGrab 的 bug 你在这里加个 auto-derby/auto_derby/template.py Line 33 in d714c1e
|
https://stackoverflow.com/questions/25467288/pils-imagegrab-is-capturing-at-the-wrong-resolution
|
解决了。。。,确实是分辨率问题,笔记本有125%缩放导致坐标获取有偏移,感谢
|
不对 这个在pillow PR4000 里修了啊
|
不是Pillow的原因,应该就是win32API的问题
|
那我这边应该也处理下不同DPI win32 应该有返回DPI缩放比率的 |
找到了一个解决方案 |
StackOverflow 回答下面有个用 SetProcessDPIAware 的 from ctypes import windll
windll.user32.SetProcessDPIAware() |
嗯,试过了,确实能行 |
这个是错误坐标下的截图
然后我在调试时改成spy++的坐标后再截图就是正确的
python版本:3.9.4
Windwos版本:21H1
The text was updated successfully, but these errors were encountered: