python - Pyautogui.moveTo() 在某些情况下不起作用
问题描述
这是我的代码:
#This program will set the Throttlestop mode to Game, Performance or Cooling as specified.
#It uses the pyautogui and sys module.
import sys
import pyautogui
mode_name = sys.argv[1]
#All necessary postions
taskbar_icon = 1769, 1049
throttlestop = 1770, 900
game = 1800, 785
performance = 1800, 760
cooling = 1800, 910
modes = {'performance':performance, 'game':game, 'cooling':cooling}
if mode_name in modes.keys():
pyautogui.moveTo(taskbar_icon) #1
pyautogui.click()
pyautogui.moveTo(throttlestop) #2
pyautogui.click(button='right')
pyautogui.moveTo(modes[mode_name]) #3
pyautogui.click()
最后两行代码似乎不起作用。其他一切正常。我想从 Win+R 运行它(在创建一个 .bat 文件之后),并且发生与 IDE 中相同的事情。我不明白为什么相同的功能会是情境性的。
解决方案
推荐阅读
- python - 成对交互 pandas 列
- java - 爪哇;接受文本字段整数限制中的空白字段
- php - 使用 PhpFastCache 和 Memcached 驱动程序向缓存条目添加标签需要很长时间
- java - 输入 ANTLR4 没有可行的替代方案
- hashmap - 如何仅使用 Java 7 按特定列名逐行对 csv 数据进行分组
- c++ - 通过 wofstream 打印到文件
- excel - 如何根据另一个单元格更新您输入值的同一单元格?
- powerbi - Power BI:客户活跃度
- python - Scrapy - 仅更改最后一个参数时刮取多个 url
- sql - 删除特殊字符分隔字符串中的重复项和 NULL