[issue14777] Tkinter clipboard_get() decodes characters incorrectly
Terry J. Reedy
report at bugs.python.org
Fri May 11 23:02:01 CEST 2012
Terry J. Reedy <tjreedy at udel.edu> added the comment:
There are definitely platform differences. As I noted, the original example works fine on Windows. However
>>> root.clipboard_get(type='STRING')
'abc€'
>>> root.clipboard_get(type='UTF8_STRING')
Traceback (most recent call last):
File "<pyshell#21>", line 1, in <module>
root.clipboard_get(type='UTF8_STRING')
File "C:\Programs\Python33\lib\tkinter\__init__.py", line 549, in clipboard_get
return self.tk.call(('clipboard', 'get') + self._options(kw))
_tkinter.TclError: CLIPBOARD selection doesn't exist or form "UTF8_STRING" not defined
Of course, on Windows I suspect that the unicode string is not copied to clipboard as utf8 bytes, so if clipboard contents are tagged, there would not be such a thing. Perhaps clipboards work differently on diffferent OSes.
>>> help(root.clipboard_get)
...
The type keyword specifies the form in which the data is
to be returned and should be an atom name such as STRING
or FILE_NAME. Type defaults to STRING.
(Actually, FILE_NAME give the same exception as UTF8_STRING.)
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue14777>
_______________________________________
More information about the Python-bugs-list
mailing list