Does customtkinter CTkButton hover has event option?


I want to perform an action when a mouse hover event occurred on customtkinter ctkbutton hover. is it yet implemented?

Asked By: Prince D.Taylor



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 callback(event):
    # put whatever you want to do 'on hover' into this function
    print('Button hovered!')

button = CTkButton(parent, text='Button!')
# use '+' to avoid overwriting the existing binding
button.bind('<Enter>', callback, add='+')  
Answered By: JRiggles
Categories: questions Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.