Skip to content

Clicking widget in hover mode executes the function

JellyfisHawthorn edited this page Jun 14, 2025 · 1 revision

The hover_func parameter allows you to specify a function to be executed after clicking the widget when the playback mode is hover.

value is a function that is executed when the play_mode is hover and the GIF widget is clicked.

The AnimatedGif widget will be passed as a parameter to this function.

If the value is None (the default), or the play_mode is not hover, the function has no effect.

Example:

case_2.py:

from tkinter import *
from TkGifWidget import *
root = Tk()

# Delete the widget after clicking on it
gif = AnimatedGif('../gif/example.gif', play_mode=HOVER, hover_func=lambda x: x.destroy())
gif.pack()

root.mainloop()

Result:

case_2.gif

Clone this wiki locally