Tkinter cho phép đổi hình dạng con trỏ chuỗi khi hover qua button/widget bằng thuộc tính cursor.
Các cursor có sẵn: "arrow", "circle", "clock", "cross", "dotbox", "exchange", "fleur", "heart", "man", "mouse", "pirate", "plus", "shuttle", "sizing", "spider", "spraycan", "star", "target", "tcross", "trek", "watch".
Ví dụ
from tkinter import *
win = Tk()
win.geometry("700x600")
win.resizable(0,0)
win.config(cursor="fleur") # Cursor mặc định cửa sổ
Label(win, text="Hover on each of these buttons", font=('Poppins', 20)).pack(pady=20)
Button(win, text="Star", cursor="star").pack(pady=20)
Button(win, text="Arrow", cursor="arrow").pack(pady=20)
Button(win, text="Circle", cursor="circle").pack(pady=20)
Button(win, text="Clock", cursor="clock").pack(pady=20)
Button(win, text="Heart", cursor="heart").pack(pady=20)
Button(win, text="Man", cursor="man").pack(pady=20)
Button(win, text="Mouse", cursor="mouse").pack(pady=20)
win.mainloop()Kết quả
Các button với con trỏ chuỗi khác nhau khi hover.
