from tkinter import *
root = Tk()
def changeCursor(event, pointerName):
root.cursor(pointerName)
link = Label(root, text="Link")
link.bind("<Motion>", lambda event : changeCursor(event, "hand"))
link.pack()
root.mainloop()
当光标悬停在指针上时,我希望光标变成“手”。我还想在光标离开标签所占据的区域时将光标改回箭头。但是我得到了以下错误:
^{pr2}$当光标位于标签所占据的区域时,如何将光标更改为手,然后在光标离开标签所占据的区域时将其改回箭头?在
如果希望光标始终是指针,只需将标签配置为具有该光标:
相关问题 更多 >
编程相关推荐