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.
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.
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).
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.
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))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With