[Tkinter-discuss] Unicode range

Nam Nguyen namnguyen at google.com
Mon Jan 4 12:39:14 EST 2021


Hi Vasilis,

Perhaps by removing characters that are outside of that range?

The error message gives you a range, from 0 to 65535. So this line might do.

s = ''.join(c for c in s if 0 < ord(c) < 65535)

Cheers,
Nam

On Mon, Jan 4, 2021 at 1:25 AM Vasilis Vlachoudis <
Vasilis.Vlachoudis at cern.ch> wrote:

> Hi all,
>
> how can I "replace/strip" unicode characters that are out of the accepted
> tk range before inserting them to Text()?
>
>   File "/usr/lib/python3.6/tkinter/__init__.py", line 3272, in insert
>     self.tk.call((self._w, 'insert', index, chars) + args)
> _tkinter.TclError: character U+1c784 is above the range (U+0000-U+FFFF)
> allowed by Tcl
>
> Vasilis
> _______________________________________________
> Tkinter-discuss mailing list
> Tkinter-discuss at python.org
> https://mail.python.org/mailman/listinfo/tkinter-discuss
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.python.org/pipermail/tkinter-discuss/attachments/20210104/aff2f03d/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4002 bytes
Desc: S/MIME Cryptographic Signature
URL: <https://mail.python.org/pipermail/tkinter-discuss/attachments/20210104/aff2f03d/attachment.bin>


More information about the Tkinter-discuss mailing list