Meters with TTKBootstrap – Tkinter TTKBootstrap 11

In this video I’ll show you how to create Meters with TTKBootstrap, Tkinter, and Python.

TTKBootstrap has a Meter widget that has all sorts of cool functionality.

We’ll look at building one in this video, as well as take a look at it’s attributes.

Python Code: meter.py
(Github Code)

from tkinter import *
import ttkbootstrap as tb


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

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


def up():
    my_meter.step(10)

def down():
    my_meter.step(-10)


global counter
counter=20

def clicker():
    global counter
    if counter <= 100:
        my_meter.configure(amountused=counter)
        counter += 5
        my_button.configure(text=f'Click Me {my_meter.amountusedvar.get()}')

my_meter = tb.Meter(root, bootstyle="danger", 
    subtext="Tkinter Learned",
    interactive=True,
    textright="%",
    #textleft="$"
    metertype="full", # Can be semi
    stripethickness=10,
    metersize=200,
    padding=50,
    amountused=0,
    amounttotal=100,
    subtextstyle="light"
    )
my_meter.pack(pady=50)

my_button = tb.Button(root, text="Click Me 5", command=clicker)
my_button.pack(pady=20)

my_button2 = tb.Button(root, text="Step Up", command=up)
my_button2.pack(pady=20)

my_button3 = tb.Button(root, text="Step Down", command=down)
my_button3.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

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...