Displaying emojis/symbols in Python using tkinter lib

后端 未结 1 572
无人及你
无人及你 2021-01-06 06:01

Does Tkinter support 16bit range characters, because I can not print emojis in the gui, when printing in python terminal, it works fine

>> print(\"         


        
1条回答
  •  别那么骄傲
    2021-01-06 06:38

    There's a bug in Tkinter that it doesn't transparently map this for you, and definitely a bug in the underlying libraries (Tcl and Tk) that the string is not accepted as is and needs intervention at all. The state is that the underlying libraries currently require that the non-BMP characters in strings be encoded as surrogate pairs.

    A little searching here provides code for actually doing this encoding.

    • Python: Find equivalent surrogate pair from non-BMP unicode char

    0 讨论(0)
提交回复
热议问题