ubuntu系统tkinter中文显示乱码

使用下面的代码获取tkinter支持的字体

from tkinter import Tk, font
root = Tk()
font.families()

ubuntu系统结果如下:

('fangsong ti', 'fixed', 'clearlyu alternate glyphs', 'courier 10 pitch', 'open look glyph', 'bitstream charter', 'song ti', 'open look cursor', 'newspaper', 'clearlyu ligature', 'mincho', 'clearlyu devangari extra', 'clearlyu pua', 'clearlyu', 'clean', 'nil', 'clearlyu arabic', 'clearlyu devanagari', 'gothic', 'clearlyu arabic extra')

代码中font选择相应字体,即可解决中文乱码

label = tk.Label(win, text="显示系统", justify=LEFT, font=('newspaper', 22), fg="black")

你可能感兴趣的:(ubuntu)