Python Tkinter Label

In this lesson we want to learn about Python Tkinter Label, A Label in Tkinter is a widget that is used to display text or an image on a GUI (Graphical User Interface). It is a non-editable widget that can be used to display any type of text, such as a title, instructions, or a message.

The Tkinter Label widget can be created by calling the Label() function, which takes one or more options as arguments. Some of the common options that can be passed to the Label widget are:

  • text: The text to be displayed on the label.
  • font: The font to be used for the text.
  • fg: The color of the text.
  • bg: The background color of the label.
  • image: An image to be displayed on the label.

Here is an example of creating a simple label in Tkinter:


In the above example, we first import the tkinter module, create a Tk object (root) and then create a label widget by calling the Label() function and passing the root window and text options. The pack() method is used to place the label on the screen and the mainloop() method is called to start the event loop and display the label on the screen.



Run the complete code and this will be the result 

Python Tkinter Label
Python Tkinter Label



Learn More on TKinter



You can also use grid or place layout management in tkinter


In the above example, grid layout is used to place the label on the screen and place layout is used to place the label on the specific position.

Leave a Comment