[PyKDE] Help with simple clipboard examples

Stephen Boulet stephen at theboulets.net
Wed Oct 27 14:26:53 BST 2004


I'd like to get and set the X-window clipboard for some short scripts, but I'm 
not doing it quite right. Can someone help me along?

def setclipboard(s):
	from qt import QApplication
	from sys import argv

	a = QApplication(argv)
	c = a.clipboard()
	c.setText(s)

def getclipboard():
	from qt import QApplication
	from sys import argv

	a = QApplication(argv)
	return a.clipboard().text()

-- 

Stephen      

If your desktop gets out of control easily,
you probably have too much stuff on it that
doesn't need to be there.
         Donna Smallin, "Unclutter Your Home"




More information about the PyQt mailing list