I want to write a program in Python runs on Ubuntu and moves the mouse cursor, just like a hardware mouse would. What should I try to connect to: X or GNOME? I am pretty sure that X would work, but I have heard that it is very low-level and difficult to use. Is there some sort of GNOME API for this sort of thing, or would I have to build my own version of GNOME with some added changes? Would it just be easier to emulate a mouse? Are any of these things possible?
There's an example using Xlib via ctypes.cdll in this ubuntuforums.org thread. The sequence of calls is LoadLibrary, XOpenDisplay, XDefaultRootWindow, XWarpPointer, XCloseDisplay.