Antonio Zagheni wrote: >> I am a begginer in Pythonu >> 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:
[eryksun] > >>> 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 [Antonio] > But I am trying to paste the clipboard content to MS word and when I do it > MS word becomes not responding. > > So, if you can help... Please show us the python script you are running and tell us how exactly you are invoking it. _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor