[Tutor] Help (Antonio Zagheni)
Antonio Zagheni
zagheni at yahoo.com
Mon Jun 24 15:34:06 CEST 2013
Hello eryksun,
Thanks for your help...
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...
Thanks a lot again,
Antonio ZAgheni.
Message: 3
Date: Sun, 23 Jun 2013 18:18:11 -0400
From: eryksun <eryksun at gmail.com>
To: Antonio Zagheni <zagheni at yahoo.com>
Cc: "tutor at python.org" <tutor at python.org>
Subject: Re: [Tutor] Help
Message-ID:
<CACL+1atPo1Fduw7YNDFtnbRDNg1pEGu4y741te++9RUNDOpePw at mail.gmail.com>
Content-Type: text/plain; charset=UTF-8
On Thu, Jun 20, 2013 at 6:10 PM, Antonio Zagheni <zagheni at 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
------------------------------
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20130624/1fbcdc09/attachment.html>
More information about the Tutor
mailing list