I'm trying to make a python script were if you put your mouse over an element in tkinter something would happen.I know i could make a function that repeats via after
and make an if statement
but i think there might be an easier way. The onmouseover
event from HTML is an exemple of what I want.
Thanks in advance!
My code:
from tkinter import Tk, Canvas, PhotoImage
root=Tk()
c=Canvas(root, width=500, height=500) # width and height are placeholders here
root.title("wdihihfwaheuih") # the title too
imag = PhotoImage(file="example.pgm")
image = c.create_image(250, 250, anchor="c", image=imag) # <-- element i want to "onmouseover"
root.mainloop()