Tkinter

Label Tkinter | Python 3

In this tutorial, we are going to see how to use Label widget in Tkinter. This Label widget is a standard Tkinter widget used to display a text or image on the screen. Label can only display text in one font. The text displayed by this widget can be updated at any time.

It is also possible to underline a part of the text and to display the text on several lines.
 


 
 

Syntax:

Here is the syntax to create this widget:

l = Label ( master, option = value, ... )

 

Parameters:
  • master : This represents the parent window.
  • options : Options can be used as comma separated key-value pairs. See the following example:

 

 

Example:
from tkinter import *

gui = Tk()
var = StringVar()
label = Label(gui, textvariable=var, relief=RAISED)

var.set("Welcome to StackHowTo!")
label.pack()
gui.mainloop()

Output:


 
mcqMCQPractice competitive and technical Multiple Choice Questions and Answers (MCQs) with simple and logical explanations to prepare for tests and interviews.Read More

Leave a Reply

Your email address will not be published. Required fields are marked *