MCPcopy Index your code
hub / github.com/python/cpython / on_motion

Method on_motion

Lib/tkinter/dnd.py:152–177  ·  view source on GitHub ↗
(self, event)

Source from the content-addressed store, hash-verified

150 pass
151
152 def on_motion(self, event):
153 x, y = event.x_root, event.y_root
154 target_widget = self.initial_widget.winfo_containing(x, y)
155 source = self.source
156 new_target = None
157 while target_widget is not None:
158 try:
159 attr = target_widget.dnd_accept
160 except AttributeError:
161 pass
162 else:
163 new_target = attr(source, event)
164 if new_target is not None:
165 break
166 target_widget = target_widget.master
167 old_target = self.target
168 if old_target is new_target:
169 if old_target is not None:
170 old_target.dnd_motion(source, event)
171 else:
172 if old_target is not None:
173 self.target = None
174 old_target.dnd_leave(source, event)
175 if new_target is not None:
176 new_target.dnd_enter(source, event)
177 self.target = new_target
178
179 def on_release(self, event):
180 self.finish(event, 1)

Callers

nothing calls this directly

Calls 4

winfo_containingMethod · 0.80
dnd_motionMethod · 0.80
dnd_leaveMethod · 0.80
dnd_enterMethod · 0.80

Tested by

no test coverage detected