Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import gtk.gdk
- from subprocess import call
- from time import sleep
- def pixel_at(x, y):
- rw = gtk.gdk.get_default_root_window()
- pixbuf = gtk.gdk.Pixbuf(gtk.gdk.COLORSPACE_RGB, False, 8, 1, 1)
- pixbuf = pixbuf.get_from_drawable(rw, rw.get_colormap(), x, y, 0, 0, 1, 1)
- return tuple(pixbuf.pixel_array[0, 0])
- sleep(2)
- for i in range(600):
- sleep(0.2)
- pix=pixel_at(2430,587)
- if pix==(207,58,0):
- key='Right'
- elif pix==(192,149,3):
- key='Down'
- elif pix==(157,2,227):
- key='Up'
- elif pix==(0,29,55):
- key='Left'
- else:
- key=''
- xdotool="xdotool key " + key
- if key!='':
- call(xdotool, shell=True)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement