- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Set style for Labelframe in Python Tkinter
Tkinter LabelFrame is similar to Frames in Tkinter Library. It works like a container where widgets can be placed. LabelFrame initially creates a container with some rectangular border around it. In order to style the LabelFrame widget, we have several style options such as background, borderwidth, labelanchor, highlightcolor and many more.
Example
In this example, we will see the LabelFrame widget and its properties.
#Import required libraries from tkinter import * #Create an instance of tkinter frame win= Tk() #Define the geometry of the window win.geometry("750x250") #Initialize a LabelFrame Widget labelframe= LabelFrame(win, text= "Frame 01",width= 600, height= 200, labelanchor= "n", font= ('Helvetica 14 bold'),bd= 5, background="gray71", foreground= "white") labelframe.pack(ipadx=10, ipady=20, expand= True, fill= BOTH) #Create a Label inside LabelFrame Label(labelframe, text= "I am inside a LabelFrame", font=('Helvetica15 bold'), foreground= "black").pack(pady= 20) win.mainloop()
Output
Running the above code will display a window that contains a labelframe with borderwidth of 5px.
- Related Articles
- Creating a LabelFrame inside a Tkinter Canvas
- Add style to Python tkinter button
- Set style for pagination with CSS
- How to set style for JTextPane in Java?
- Set image for bullet style with CSS
- How to set font for Text in Tkinter?
- Python Tkinter – Set Entry width 100%
- How to set focus for Tkinter widget?
- PDF Viewer for Python Tkinter
- Set a default value for a ttk Combobox in Tkinter?
- Set the line style for the outline with CSS
- Setting Background color for Tkinter in Python
- Set Media Queries for different CSS style rules for different size devices
- Where to learn Tkinter for Python?
- How to set the font style to Bold in Python Plotly?

Advertisements