Help about Xlib Library in Python

阮铮 rz1991 at foxmail.com
Thu Dec 15 23:55:13 EST 2011


Hi,


A question about Xlib Library in Python troubled me for several days and I finally found this email list. I hope someone could answer my question. I think it is easy for experienced user.


I would like to write a small script to response my mouse click in root screen and write something in the terminal. My script is like this, but it does not work in my computer.


from Xlib import X
import Xlib.display


def main():
    display = Xlib.display.Display()
    root = display.screen().root
    root.change_attributes(event_mask=
			X.ButtonPressMask |
			X.ButtonReleaseMask)
    while True:
        event = root.display.next_event()
        print "1"
if __name__ == "__main__":
    main()





Any hints are welcome
Thank you!


Ruan zheng
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20111216/dc97f5ae/attachment-0001.html>


More information about the Python-list mailing list