使用tkFont模块设置中文标题的字体粗细和斜体
发布时间:2023-12-28 01:30:22
import tkinter as tk
import tkinter.font as tkFont
def set_chinese_font():
root = tk.Tk()
root.title("设置中文标题的字体粗细和斜体")
# 创建字体对象
font = tkFont.Font(family="微软雅黑", size=24, weight=tkFont.BOLD, slant=tkFont.ITALIC)
# 创建标签对象,并设置字体
label = tk.Label(root, text="中文标题", font=font)
label.pack()
root.mainloop()
set_chinese_font()
