Return to Snippet

Revision: 17384
at September 2, 2009 16:05 by simlan


Updated Code
from Xlib import X, display
d = display.Display().screen().root.query_pointer()._data

print "x="
print d["root_x"]
print "y="
print d["root_y"]

Revision: 17383
at September 2, 2009 15:58 by simlan


Initial Code
from Xlib import X, display
d = display.Display()
s = d.screen()
root = s.root
a=root.query_pointer()
b=a._data
print "x="
print b["root_x"]
print "y="
print b["root_y"]
#d.sync() Not necessary

Initial URL
http://simlan.tumblr.com/post/2658047235/cursorposition-on-linux-printing

Initial Description
Quick and dirty took me 2hours to find. The Xlib Documentation sucks. Have Fun\r\n\r\nnote: U need the Xlib -(Ubuntu)-> sudo apt-get install python-xlib

Initial Title
Mouseposition on Linux via Xlib

Initial Tags
linux

Initial Language
Python