擅长:python、mysql、java
<p>我想你可以用<a href="http://xmacro.sourceforge.net/" rel="nofollow noreferrer">xmacroplay utility from xmacro</a>在X窗口下这样做。或者直接使用它——使用subprocess模块将它的命令发送到标准输入,或者阅读源代码并找出它是如何做到的!我不认为它有python绑定。在</p>
<p>从xmacroplay网站</p>
<pre><code>xmacroplay:
Reads lines from the standard input. It can understand the following lines:
Delay [sec] - delays the program with [sec] secundums
ButtonPress [n] - sends a ButtonPress event with button [n]
this emulates the pressing of the mouse button [n]
ButtonRelease [n] - sends a ButtonRelease event with button [n]
this emulates the releasing of the mouse button [n]
... snip lots more ...
</code></pre>
<p>这可能是您感兴趣的命令</p>
^{pr2}$
<p>还有一个<a href="http://www.gnu.org/software/xnee/" rel="nofollow noreferrer">Xnee</a>也做了类似的事情。在</p>