How can I use xdotool from within a python module/script?

python, ubuntu

Solution

import subprocess

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

etc. See the `subprocess` docs.

Problem

For example, if I wanted to use something like: ``` xdotool mousemove 945 132 xdotool click 1 ``` 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.

Original source