In this video I’ll show you how to use the TTKBootstrap Floodgauge for TKinter and Python.

The Flood Guage is like a progressbar but a little bit fancier than what normally comes with Tkinter.

We’ll look at all it’s main attributes in this video, including starting floodgauge, stopping floodgauge, and incrementing floodgauge using steps.

Python Code: flood.py
(Github Code)

from tkinter import *
import ttkbootstrap as tb

root = tb.Window(themename="superhero")

#root = Tk()
root.title("TTK Bootstrap! Floodgauge")
root.iconbitmap('images/codemy.ico')
root.geometry('500x550')


def starter():
	# Start the guage
	my_gauge.start()
	while my_gauge.variable.get() < 80:
		my_label.config(text=f"Position: {my_gauge.variable.get()}")

def stopper():
	my_gauge.stop()

def incrementer():
	my_gauge.step(10)
	my_label.config(text=f"Position: {my_gauge.variable.get()}")



my_gauge = tb.Floodgauge(root, bootstyle="success",
	font=("Helvetica", 18),
	mask="Pos: {}%",
	maximum=80,
	orient="horizontal",
	value=0,
	mode="determinate"
	)
my_gauge.pack(pady=50, fill=X, padx=20)


start_button = tb.Button(root, text="Start", bootstyle="danger outline", command=starter)
start_button.pack(pady=20)

stop_button = tb.Button(root, text="Stop", bootstyle="danger outline", command=stopper)
stop_button.pack(pady=20)

inc_button = tb.Button(root, text="Increment", bootstyle="danger outline", command=incrementer)
inc_button.pack(pady=20)

my_label = tb.Label(root, text="Position: ")
my_label.pack(pady=20)



root.mainloop()

John Elder

John is the CEO of Codemy.com where he teaches over 100,000 students how to code! He founded one of the Internet's earliest advertising networks and sold it to a publicly company at the height of the first dot com boom. After that he developed the award-winning Submission-Spider search engine submission software that's been used by over 3 million individuals, businesses, and governments in over 42 countries. He's written several Amazon #1 best selling books on coding, and runs a popular Youtube coding channel.

View all posts

Add comment

Your email address will not be published. Required fields are marked *

John Elder

John is the CEO of Codemy.com where he teaches over 100,000 students how to code! He founded one of the Internet's earliest advertising networks and sold it to a publicly company at the height of...