zzz123
zzz123

Reputation: 381

Make a Label Bold Tkinter

How do I make a Label in 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 ?

Upvotes: 27

Views: 159943

Answers (4)

UndrDskM
UndrDskM

Reputation: 21

almost right! but replace font size with font type

tkinter.Label(frame1, text='Hello', font=('Helvetica', 18, 'bold'))

Upvotes: 2

Kirro Smith
Kirro Smith

Reputation: 91

Just put bold in the quotes, example : label = Label(frame1, text = "TEXTTEXT", font = ('Helvetica', 18, 'bold')) That work for me, configure also work but you have to make one more line of code. If you want, I can show you how to .configure: Just add this code : label.configure(font=("Helvetica","bold", 18))

Thanks. :)

Upvotes: 7

Trooper Z
Trooper Z

Reputation: 1661

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

Upvotes: 17

adder
adder

Reputation: 3698

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

Upvotes: 42

Related Questions