
text | Message or text to be displayed on popup window. |
bootstyle | Style keyword, options are primary, secondary, success,info,warning,danger, light, dark |
wraplength | The width of the popup window in screenunits before the text is wrapped to the next line. |
**kwargs | Other keyword arguments. |
import ttkbootstrap as ttk
from ttkbootstrap.constants import *
from ttkbootstrap.tooltip import ToolTip
my_w = ttk.Window()
my_w.geometry("500x200") # width and height
b1 = ttk.Button(my_w, text="Start", bootstyle=SUCCESS)
b1.grid(row=2, column=1, padx=40, pady=40)
b2 = ttk.Button(my_w, text="Stop", bootstyle=DANGER)
b2.grid(row=2, column=2, padx=40, pady=40)
b3 = ttk.Button(my_w, text="Jump", bootstyle=PRIMARY)
b3.grid(row=2, column=3, padx=40, pady=40)
b4 = ttk.Button(my_w, text="Reset", bootstyle=WARNING)
b4.grid(row=2, column=4, padx=40, pady=40)
tt1 = ToolTip(b1, text="This is to Start", bootstyle=(INFO, INVERSE))
tt2 = ToolTip(b2, text="This is Stop the Project", bootstyle=(DANGER))
tt3 = ToolTip(b3, text="This is Jump the Project", bootstyle=(SUCCESS, INVERSE))
tt4 = ToolTip(
b4, text="This is Reset the Project", wraplength=100, bootstyle=(SECONDARY, INVERSE)
)
my_w.mainloop()

import ttkbootstrap as ttk
from ttkbootstrap.constants import *
from ttkbootstrap.tooltip import ToolTip
my_w = ttk.Window()
my_w.geometry("520x320") # width and height
fg = ttk.Floodgauge(
bootstyle=INFO,
mask="Progress {}%",
value=10,
length=500,
)
fg.grid(row=1, column=1, padx=10, pady=50, columnspan=4)
b1 = ttk.Button(my_w, text="Start", command=lambda: fg.start(), bootstyle=SUCCESS)
b1.grid(row=2, column=1, padx=10, pady=40)
b2 = ttk.Button(my_w, text="Stop", command=lambda: fg.stop(), bootstyle=DANGER)
b2.grid(row=2, column=2, padx=10, pady=40)
b3 = ttk.Button(my_w, text="Jump", command=lambda: fg.step(5), bootstyle=PRIMARY)
b3.grid(row=2, column=3, padx=10, pady=40)
b4 = ttk.Button(
my_w, text="Reset", command=lambda: fg.configure(value=10), bootstyle=WARNING
)
b4.grid(row=2, column=4, padx=10, pady=40)
def my_upd(*args):
if fg.variable.get() < 25:
fg.configure(bootstyle=INFO)
tt1.show_tip()
elif fg.variable.get() < 50:
fg.configure(bootstyle=SUCCESS)
tt1.hide_tip()
elif fg.variable.get() < 80:
fg.configure(bootstyle=WARNING)
else:
fg.configure(bootstyle=DANGER)
fg.variable.trace("w", my_upd)
tt1 = ToolTip(b1, text="This is Started", bootstyle=(INFO, INVERSE))
tt2 = ToolTip(b2, text="This will Stop the Project", bootstyle=(DANGER))
tt3 = ToolTip(b3, text="This is to Jump the Project", bootstyle=(SUCCESS, INVERSE))
tt4 = ToolTip(
b4, text="This is Reset the Project", wraplength=100, bootstyle=(SECONDARY, INVERSE)
)
my_w.mainloop()
Toast Notification
Author & Instructor at plus2net
I write and maintain practical tutorials on Python, PHP, SQL, JavaScript, HTML, jQuery, and web development at plus2net. The tutorials focus on clear explanations, working examples, and code that readers can test and adapt while learning.