Tkinter not displaying Unicode characters properly on Linux
<p>While on Windows tkinter seems to display the characters properly, the same does not happen with the same code on Linux.</p>

<p>I've tried the method shown <a href="http://tkinter.unpythonic.net/wiki/UnicodeSupport]" rel="nofollow">here</a>, adding a <code>.encode("utf-8")</code> after the character, but that just makes the char go hairwire on both systems. I've also tried just to copy and paste the character instead of using the unicode representation, and while that works on Windows, the same can't be said for Linux.</p>

<p>A snippet of code that shows my problem:</p>

<pre><code># -*- coding: utf-8 -*-
from tkinter import *


master = Tk()
previous_button = Button(master,
                         text=u'\u23EE',
                         relief='flat',
                         activebackground='#282828',
                         activeforeground='#1DB954',
                         bg='#282828',
                         fg='#1DB954',
                         borderwidth=0,
                         bd=0,
                         highlightthickness=0,
                         font='arial 11',
                         )

next_button = Button(master,
                     text=u'\u23ED',
                     relief='flat',
                     activebackground='#282828',
                     activeforeground='#1DB954',
                     bg='#282828',
                     fg='#1DB954',
                     bd=0,
                     highlightthickness=0,
                     borderwidth=0,
                     font='arial 11',
                     )

previous_button.grid()
next_button.grid()

mainloop()
</code></pre>

<p>Windows:
<a href="http://i.stack.imgur.com/qQUXp.png" rel="nofollow"><img src="http://i.stack.imgur.com/qQUXp.png" alt="The buttons as seen on windows"></a></p>

<p>Linux:
<a href="http://i.stack.imgur.com/nxg5j.png" rel="nofollow"><img src="http://i.stack.imgur.com/nxg5j.png" alt="The same buttons on Linux"></a></p>

<p>How to make tkinter render these unicodes on Linux?</p>

<p>All modern Linux GUI toolkits support font substitution since about 2003 (the toolkit will use other fonts to complete the selected one if it's missing glyphs), but tk is not a modern toolkit, it is windows-oriented and butt-ugly on Linux, and it largely missed this change, not sure how stuck in the past it currently is (see also fontconfig, harfbuzz-ng, pango).</p>

<p>You need to make sure you've installed a font that includes the glyphs you're needing (check with right-click in gucharmap). Common fonts with large encoding on Linux are Dejavu for example.</p>

<p>If your tk version finally caught up with the rest of the toolkits it will use this font transparently to complete the one you selected. If not you need to select explicitly the correct font in your code.</p>

<p>It is quite unlikely you'll find common fonts on Linux and Windows. Linux systems deploy free and open fonts, Microsoft deploys proprietary fonts with restrictive licensing. The Arial you find on the system is probably an obsolete incomplete buggy version with dubious licensing, that most Linux versions refuse to deploy. Don't count on it existing elsewhere and don't ask others to deploy it if you want to avoid legal problems.</p>

<p>Conversely, most fonts you find on Linux can be deployed without restrictive conditions on Windows, but won't be by default. Check the license of the fonts you want to use before making a final choice.</p>

python python-3.x unicode tkinter