如何更改标签小部件中的文本大小,python tkinter

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/30685308/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-19 08:49:05  来源:igfitidea点击:

How do I change the text size in a label widget, python tkinter

pythontkinterlabel

提问by james hughes

In python 3.4 using Tkinter, how do I change the text size in a label widget?

在使用 Tkinter 的 python 3.4 中,如何更改标签小部件中的文本大小?

So far I have tried

到目前为止我已经尝试过

label_one = Label(root, text = 'Hello', size = '50')

and

label_one.config(fontsize='50')

But I am not sure where to start and I can't find anything saying how to do it.

但我不确定从哪里开始,我找不到任何说明如何去做的事情。

采纳答案by Ashwinee K Jha

Try passing width=200as additional paramater when creating the Label.

width=200在创建标签时尝试作为附加参数传递。

This should work in creating label with specified width.

这应该适用于创建具有指定宽度的标签。

If you want to change it later, you can use:

如果您想稍后更改它,您可以使用:

label.config(width=200)

As you want to change the size of font itself you can try:

如果您想更改字体本身的大小,您可以尝试:

label.config(font=("Courier", 44))