Python Forum
What kind of widget is it? - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: GUI (https://python-forum.io/forum-10.html)
+--- Thread: What kind of widget is it? (/thread-25612.html)



What kind of widget is it? - aquerci - Apr-05-2020

Hi guys,

someone can help me to understand what kind of widget has been circled in red in the attached image?

I would very like to replicate it in my GUI but I don't know how. it seems a "LabelFrame" widget (I attached another image), but it's not the same. How can I create the same widget with tkinter?

sorry guys, maybe it's an obvious question, but I don't know tkinter so much, I started studying recently.


RE: What kind of widget is it? - DT2000 - Apr-05-2020

I believe what you are looking to use would be the ttk.Separator.

import tkinter as tk
from tkinter import ttk

root = tk.Tk()
# PADX aligns the Separator clearance from edge of left side and right side
PADX = 5

toolbar = tk.Frame(root).grid(padx=100, pady=10)

button1 = tk.Button(toolbar, text="Home").grid(padx=10,pady=10)
sep = ttk.Separator(toolbar, orient=tk.HORIZONTAL).grid(padx=PADX * 2, pady=10, sticky=tk.EW)
sepL =tk.Label(toolbar, text="   Using a 'ttk.Separator' widget").grid(padx=PADX, sticky=tk.W)
button2 = tk.Button(toolbar, text="Insert").grid(padx=50, pady=10)

root.mainloop()
I hope this helps and points you in the right direction.