ภาพรวม
Tooltips มีประโยชน์ในแอปที่ต้องแสดงข้อมูลขณะ Hover บนปุ่ม สร้างและแสดง Tooltip ได้ด้วย Property Balloon ของ Tkinter
ตัวอย่างโค้ด
# Import the tkinter library
from tkinter import *
from tkinter.tix import *
# Create an instance of tkinter frame
win = Tk()
# Set the geometry
win.geometry("600x450")
# Create a tooltip
tip = Balloon(win)
# Create a Button widget
my_button = Button(win, text="Hover Me")
my_button.pack(pady=20)
# Bind the tooltip with button
tip.bind_widget(my_button, balloonmsg="www.tutorialspoint.com")
win.mainloop()
ผลลัพธ์
โค้ดจะแสดงหน้าต่างพร้อม Button "Hover Me" เมื่อ User Hover จะแสดง Tooltip Text
