On Thu, Jun 20, 2013 at 6:10 PM, Antonio Zagheni <zagh...@yahoo.com> wrote: > > I am a begginer in Python. > I did a function that returns a string and I want to copy this to the > clipboard. > I have tried a lot of suggestions found at Google but nothing works properly. > Is there an easy way to do that? > I am using Python 2.7 and Windows 7.
It's simple to access the clipboard with Tkinter: >>> from Tkinter import Tk, TclError >>> root = Tk() >>> root.withdraw() '' >>> root.clipboard_clear() >>> root.clipboard_append('eggs ') >>> root.clipboard_append('and spam') >>> root.clipboard_get() 'eggs and spam' >>> root.clipboard_clear() >>> try: root.clipboard_get() ... except TclError as e: print e ... CLIPBOARD selection doesn't exist or form "STRING" not defined _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor