xlib

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
#!/usr/bin/python2.4
from Xlib.display import Display
from Xlib import X
import select
def handle_event(Event):
print "event ", Event.detail. Event.type
disp = Display()
print "1"
root = disp.screen().root
root.change_attributes(event_mask = X.KeyPressMask)
print "2"
while 1:
event = root.display.next_event()
print "event"
handle_event(event)