Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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

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.

like image 386
james hughes Avatar asked Jun 06 '15 16:06

james hughes


People also ask

How do I change font size in labels?

To change the font size in HTML, use the style attribute. The style attribute specifies an inline style for an element. The attribute is used with the HTML <p> tag, with the CSS property font-size.

What will be the way to change font and its size in tkinter label?

Tkinter Label Widgets are used to create labels in a window. We can style the widgets using the tkinter. ttk package. In order to resize the font-size, font-family and font-style of Label widgets, we can use the inbuilt property of font('font-family font style', font-size).

Can you change the text of a label in tkinter?

Tkinter Label widgets are commonly used in applications to show text or images. You can change the label widget's text property, color, background, and foreground colors using different methods. You can update the text of the label widget using a button and a function if you need to tweak or change it dynamically.


1 Answers

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)) 
like image 74
Ashwinee K Jha Avatar answered Sep 17 '22 16:09

Ashwinee K Jha