1

Why tkinter.Frame in python does not work with someframe.bind("<Motion>", somefunc)? In this case somefunc does not get executed. Can someone please explain this to me?

code: self.frame.bind("<Motion>", tippy.update)

If I bind this to for example tkinter.Label, everything works as expected. Code is executed.

EDIT: I thought that if I have tkinter.Label in tkinter.Frame and if I hover the mouse over the tkinter.Label, it will get executed because its in the tkinter.Frame. However tkinter.Frame detects movement only if there is no other widget in the place. Basically i thought that tkinter.Frame space is not overwrited with tkinter.Label.

Jakub Bláha
  • 1,491
  • 5
  • 22
  • 43

1 Answers1

0

The below code demonstrates that the <Motion> event does work with a Frame widget in tkinter:

from tkinter import *

root = Tk()

def callback(*args):
    print("Motion detected")

frame = Frame(root, width=100, height=100)

frame.bind("<Motion>", callback)

frame.pack()

root.mainloop()

If you can provide an MCVE we can try and help you through whatever problem you're having.

Ethan Field
  • 4,646
  • 3
  • 22
  • 43