Try the code at this page. It defines a couple of functions, mousemove and mouseclick, which hook into Apple's integration between Python and the platform's Quartz libraries. This code works on 10.6, and I'm using it on 10.7. The nice thing about this code is that it generates mouse events, which some solutions don't. I use it to control BBC iPlayer by sending mouse events to known button position