How do I change my cursor to a hand ONLY when it is hovering over a Label? How do I change my cursor to a hand ONLY when it is hovering over a Label? tkinter tkinter

How do I change my cursor to a hand ONLY when it is hovering over a Label?


If you want the cursor to always be the hand, just configure the label to have that cursor:

import tkinter as tkroot = tk.Tk()label = tk.Label(root, text="Hello, world", background="bisque", cursor="hand1")label.pack(side="top", fill="x", padx=10, pady=10)root.mainloop()


import tkinter as tk    root = tk.Tk()    myLabel= tk.Label(root, text="Click Me", cursor="hand2")myLabel.pack()    root.mainloop()


For a quick preview of the available cursors:

(taken from https://www.tcl.tk/man/tcl8.4/TkCmd/cursors.htm)

import tkinter as tkroot = tk.Tk()frame = tk.Frame(root)frame.pack(expand=True, fill=tk.BOTH)cursors = """X_cursorarrowbased_arrow_downbased_arrow_upboatbogositybottom_left_cornerbottom_right_cornerbottom_sidebottom_teebox_spiralcenter_ptrcircleclockcoffee_mugcrosscross_reversecrosshairdiamond_crossdotdotboxdouble_arrowdraft_largedraft_smalldraped_boxexchangefleurgobblergumbyhand1hand2hearticoniron_crossleft_ptrleft_sideleft_teeleftbuttonll_anglelr_anglemanmiddlebuttonmousepencilpirateplusquestion_arrowright_ptrright_sideright_teerightbuttonrtl_logosailboatsb_down_arrowsb_h_double_arrowsb_left_arrowsb_right_arrowsb_up_arrowsb_v_double_arrowshuttlesizingspiderspraycanstartargettcrosstop_left_arrowtop_left_cornertop_right_cornertop_sidetop_teetrekul_angleumbrellaur_anglewatchxterm""".split()i = 0j = 0for cur in cursors:    if i == 20:        i = 0        j += 1    tk.Button(frame, text=cur, height=2, width=15, cursor=cur).grid(row=i, column=j)    i += 1tk.mainloop()