如何在标签窗口小部件python tkinter中更改文本大小 [英] How do I change the text size in a label widget, python tkinter

查看:681
本文介绍了如何在标签窗口小部件python tkinter中更改文本大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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

到目前为止,我已经尝试过

So far I have tried

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

label_one.config(fontsize='50')

但是我不确定从哪里开始,找不到任何说明如何做的东西.

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

推荐答案

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

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

这应该可以创建具有指定宽度的标签.

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))

这篇关于如何在标签窗口小部件python tkinter中更改文本大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆