Get The Primary Buffer Content Using GTK and Python
July 17, 2010 Leave a comment
That is it, just the three following lines:
import gtk clipboard = gtk.clipboard_get(gtk.gdk.SELECTION_PRIMARY) print clipboard.wait_for_text()
More information about what are the interned strings and objects from gtk.gdk.Atom, it is here. Another interesting script in Python that deals with primary buffer is this one made to monitor the primary buffer. Another one is made to copy from the clipboard itself, it is here. Another one is a complete example how to make a textbox with Copy, Cut, and Paste features using PyGTK.