import threading import gtk import time class Clipboard(threading.Thread): def __init__(self): threading.Thread.__init__(self) while(True): # Forever loop self.clip = self.get_clipboard() time.sleep(2) def get_clipboard(self): clip = gtk.clipboard_get(gtk.gdk.SELECTION_CLIPBOARD) print 1 text = clip.request_text(self.get_text) def get_text(self, clipboard, text): print 2 print text Clipboard().start()