Tkinter Tutorial - Status Bar

Jinku Hu Jan 03, 2023 May 22, 2019
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

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()

Tkinter Status Bar Example

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.

Author: Jinku Hu
Jinku Hu avatar Jinku Hu avatar

Founder of DelftStack.com. Jinku has worked in the robotics and automotive industries for over 8 years. He sharpened his coding skills when he needed to do the automatic testing, data collection from remote servers and report creation from the endurance test. He is from an electrical/electronics engineering background but has expanded his interest to embedded electronics, embedded programming and front-/back-end programming.

LinkedIn