Python 制作一个大胆的标签 Tkinter

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/46495160/
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 17:40:08  来源:igfitidea点击:

Make a Label Bold Tkinter

pythontkinterlabel

提问by zzz123

How do I make a Label in Tkinter Bold ?

如何在 Tkinter Bold 中制作标签?

This is my code

这是我的代码

labelPryProt=Label(frame1,text="TEXTTEXT")
labelPryProt.pack(side=LEFT,fill=BOTH,expand=False)
labelPryProt.configure(font=("Helvetica",BOLD, 18))#this is not working not making the text as bold

What is the error ?

什么是错误?

回答by adder

You don't have to configure it separately, you can pass an argument when you are creating the widget:

您不必单独配置它,您可以在创建小部件时传递参数:

labelPryProt = Label(frame1, text='TEXTTEXT', font='Helvetica 18 bold')

回答by Trooper Z

You have to put boldin quotes, like this: label = Label(frame1, text='Hello', font=('Helvetica', 18, 'bold')). This method works for me.

你必须加上bold引号,像这样:label = Label(frame1, text='Hello', font=('Helvetica', 18, 'bold'))。这个方法对我有用。