I am trying to find the best font for displaying utf-8 characters in a tk.Text
.
I let python print all the family names known to tk using this code:
When specifying fonts in this manner, use a tuple:
text.configure(font=("Times New Roman", 12, "bold"))
Even better, you can create your own custom font objects and specify the attributes by name. Note: before you can create a font object you must first create a root window.
# python 2
# import Tkinter as tk
# from tkFont import Font
# python 3
import tkinter as tk
from tkinter.font import Font
root = tk.Tk()
text = tk.Text(root)
...
myFont = Font(family="Times New Roman", size=12)
text.configure(font=myFont)
The advantage to creating your own fonts is that you can later change any attribute of the font, and every widget that uses that font will automatically be updated.
myFont.configure(size=14)