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 abo
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.vlachou...@cern.ch> wr
Many thanks Nam,
I followed your suggestion and modified a bit as
_UNICODE_RANGE = re.compile(u'[^\u-\u]', re.UNICODE)
...
except tk.TclError:
# when it fails try to remove unicode outside the accepted range
self.text.insert("0.0", _UNICODE_RANGE.sub("?",log.messages))
which is fa