Tkinter

LabelFrame Tkinter | Python 3

In this tutorial, we are going to see how to use LabelFrame in Tkinter. LabelFrame is a simple container widget. Its main purpose is to act as a separator or container for complex window layouts.

This widget has the characteristics of a Frame plus the ability to display a label.
 


 
 

Syntax: LabelFrame in Tkinter

Here is the syntax to create this widget:

lframe = LabelFrame ( master, option = value, ... )

 

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

 

 

Example: How to use LabelFrame in Tkinter
from tkinter import *

gui = Tk()

lframe = LabelFrame(gui, text="This is a LabelFrame")
lframe.pack(fill="both", expand="yes")
 
btn = Button(lframe, text ="Click here!")
btn.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 *