Naseem Tomkinson
Naseem Tomkinson

Reputation: 119

Boxed Text Styling - Python 3.x - Tkinter

I have been looking online for a good few hours on how to achive this enter image description here

I remember seeing this somewhere, i'm not sure where if anyone could link it to me or reply with some code that would reproduce this that would be great!

Upvotes: 0

Views: 31

Answers (1)

Bryan Oakley
Bryan Oakley

Reputation: 386362

Assuming are referring to the border with the word "Title" in it, that is called a LabelFrame. Both the tkinter and ttk packages define a LabelFrame class.

Example:

# python 2
# import Tkinter as tk
# import ttk

# python 3
import tkinter as tk
from tkinter import ttk


root = tk.Tk()

lf1 = tk.LabelFrame(root, text="Title (tkinter)", width=400, height=100)
lf2 = ttk.LabelFrame(root, text="Title (ttk)", width=400, height=100)
lf1.pack(side="top", fill="both", expand=True, padx=4, pady=4)
lf2.pack(side="top", fill="both", expand=True, padx=4, pady=4)

root.mainloop()

Upvotes: 1

Related Questions