0

It is a known problem of Tkinter/Tcl in Python3 that it only supports characters between U+0000-U+FFFF.

There are some solutions around parsing strings and replacing the not allowed characters with placeholders or codes. But I have to know that there is a disallowed character in before this make sense.

Do I really have to use this parsing-replacing-algorithms for every string I put in my Tkinter GUI? The essential point of my question is that I have data (webfeeds) I don't know. Do I have to parse this big amount of data only because one of some millions of this data pieces use unallowed characters?

Is there a pythonic way to solve this? Can I use parsing-replacing-algorithms without wasting too many resources?

#!/usr/bin/env python3

from tkinter import *

if __name__ == '__main__':
    root = Tk()

    l = Listbox(root)
    l.pack()

    d = ['A', 'B', u'\U0001F384', 'D']

    for s in d:
        l.insert(END, s)

    root.mainloop()
Nae
  • 14,209
  • 7
  • 52
  • 79
buhtz
  • 10,774
  • 18
  • 76
  • 149

1 Answers1

2

The first solution was really to parse such characters for myself and replace them.

The second and later solution was to switch to a different GUI toolkit. I am using Gtk (PyGObject) now.

buhtz
  • 10,774
  • 18
  • 76
  • 149