import gtk clip = gtk.clipboard_get(selection='PRIMARY') print clip.wait_for_text()