คำแนะนำเครื่องมือมีประโยชน์ในแอปพลิเคชันที่เราจำเป็นต้องแสดงข้อมูลบางอย่างในขณะที่วางเมาส์เหนือปุ่ม
ในการสร้างและแสดงคำแนะนำเครื่องมือ เราสามารถใช้ บอลลูน คุณสมบัติของ 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() ผลลัพธ์
รหัสด้านบนจะแสดงหน้าต่างต่อไปนี้พร้อมปุ่ม "วางเมาส์เหนือฉัน" เมื่อผู้ใช้วางเมาส์เหนือปุ่ม จะแสดงข้อความคำแนะนำเครื่องมือ
