如何在 python 模块/脚本中使用 xdotool? [英] How can I use xdotool from within a python module/script?

查看:63
本文介绍了如何在 python 模块/脚本中使用 xdotool?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

例如,如果我想使用类似的东西:

For example, if i wanted to use something like:

xdotool mousemove 945 132

xdotool mousemove 945 132

xdotool 点击 1

xdotool click 1

为了将鼠标移动到某个位置并点击.在 ubuntu 中,我可以直接在终端中输入这些命令以获得所需的效果,但我想将它们放在 Python 脚本中.提前致谢!

In order to move the mouse to a certain location and click. In ubuntu I can just type these commands straight into the terminal to get the desired effect but I would like to put them inside of a Python script. Thanks in advance!

推荐答案

import subprocess

subprocess.call(["xdotool", "mousemove", "945", "132"])

等等.请参阅 subprocess 文档.

etc. See the subprocess docs.

这篇关于如何在 python 模块/脚本中使用 xdotool?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆