I want to perform an action when a mouse hover event occurred on customtkinter ctkbutton hover. is it yet implemented?
Per the CTkButton
source code, the on_enter
method is bound to the <Enter>
event. This method is predominantly focused on updating the button's appearance on hover. If you want to trigger an additional callback on hover, you'll have to add another binding to the button
def on_enter(event):
# put whatever you want to do 'on hover' into this function
print('Button hovered!')
def on_leave(event):
print(event) # do something here
button = CTkButton(parent, text='Button!')
# use '+' to avoid overwriting the existing binding
button.bind('<Enter>', on_enter, add='+')
# you may also want to bind to '<Leave>' to complete the hover handler
button.bind("<Leave>", on_leave, add='+')
button.pack()