[New-bugs-announce] [issue21580] PhotoImage(data=...) apparently has to be UTF-8 or Base-64 encoded
report at bugs.python.org
Mon May 26 07:52:24 CEST 2014
New submission from Martin Panter:
At the bottom of the “tkinter” doc page it mentions the “data” option is available. However I was unable to get it to work well when passing a plain bytes() string in. It seems the bytes() string gets interpreted as UTF-8 somewhere along the line, although the underlying TCL library apparenly handles byte strings fine itself. Passing binary GIF and PNG data in Python would usually produce strange exceptions, crashes, and blank images for me.
I found this message with a simple patch which might be useful, though I’m not familiar with the code involved to understand the implications:
Even if that fix is not appropriate, can I suggest adding to the documentation to say the data should be encoded with one of these options that seem to work? The Base-64 one is probably better.
assignee: docs at python
components: Documentation, Tkinter
nosy: docs at python, vadmium
title: PhotoImage(data=...) apparently has to be UTF-8 or Base-64 encoded
versions: Python 3.4
Python tracker <report at bugs.python.org>
More information about the New-bugs-announce