python的Tkinter中怎样改变文本的字的大小?
你可以创建一个字体对象。导入tkFont模块,并使用其字体类的构造:
import tkFont
font = tkFont.Font ( option, ... )
下面是选项列表:
family: 作为一个字符串的字体系列名称.
size: 作为一个整数,以点字体的高度。为了获得字体的n个像素高,使用-n.
weight: "bold" for boldface, "normal" for regular weight.
slant: "italic" for italic, "roman" for unslanted.
underline: 1 for underlined text, 0 for normal.
overstrike: 1 for overstruck text, 0 for normal.
例子:
helv36 = tkFont.Font(family="Helvetica",size=36,weight="bold")
Copyright © 广州京杭网络科技有限公司 2005-2025 版权所有 粤ICP备16019765号
广州京杭网络科技有限公司 版权所有