是否可以为 Checkbutton 小部件(tkinter)设置 2 个不同的光标?

Is it possible to set 2 different cursors for a Checkbutton widget (tkinter)?

我已经在internent 上搜索过但没有任何回应。我使用了一个带有 indicatoron=FALSE 的 tkinter Checkbutton,这让它看起来只是一个按钮。

我已经设置了光标,但我想知道是否可以为复选按钮的 on/off 状态设置 2 个不同的光标。

例如:

test = tk.Checkbutton(self.frame, text=self.name, indicatoron=False, selectcolor="green", background="red", variable=self.varbutton, command=self.launchsound, cursor="plus") 
test.pack()

您可以根据 command 中的变量 varbutton:

import tkinter as tk

def changeCursor():
    if varbutton.get():
        test['cursor'] = 'hand2'
    else:
        test['cursor'] = 'plus'
    # pass

r = tk.Tk()
varbutton = tk.BooleanVar()
test = tk.Checkbutton(r, text="a", indicatoron=False, selectcolor="green", background="red", cursor="plus", command=changeCursor, variable=varbutton)
test.pack()
r.mainloop()