Tkinter Tutorial - Status Bar
A status bar is normally a narrow bar at the bottom of the GUI to indicate some extra information like word counts of the file or anything that could add extra value to the user interface.
Tkinter doesn’t have a dedicated status bar widget but uses Label
widget with appropriate configuration to work as the status bar in the GUI.
Tkinter Status Bar
Tkinter Status Bar_Basic.py
import tkinter as tk
app = tk.Tk()
app.geometry('300x200')
app.title("Basic Status Bar")
statusbar = tk.Label(app, text="on the way…", bd=1, relief=tk.SUNKEN, anchor=tk.W)
statusbar.pack(side=tk.BOTTOM, fill=tk.X)
app.mainloop()
statusbar = tk.Label(app, text="on the way…", bd=1, relief=tk.SUNKEN, anchor=tk.W)
bd
sets the size of the border and relief
determines how the label appears. We prefer the label to appear sunken so that the status bar looks like seamlessly one part of the window.
anchor
sets the alignment of the text inside the label. W
means West
or left aligned.
statusbar.pack(side=tk.BOTTOM, fill=tk.X)
This status bar is positioned at the bottom of the GUI and always covers the whole width of the window if we resize the window.
Write for us
DelftStack articles are written by software geeks like you. If you also would like to contribute to DelftStack by writing paid articles, you can check the write for us page.