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

Class Tester

Lib/tkinter/dnd.py:269–301  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

267
268
269class Tester:
270
271 def __init__(self, root):
272 self.top = tkinter.Toplevel(root)
273 self.canvas = tkinter.Canvas(self.top, width=100, height=100)
274 self.canvas.pack(fill="both", expand=1)
275 self.canvas.dnd_accept = self.dnd_accept
276
277 def dnd_accept(self, source, event):
278 return self
279
280 def dnd_enter(self, source, event):
281 self.canvas.focus_set() # Show highlight border
282 x, y = source.where(self.canvas, event)
283 x1, y1, x2, y2 = source.canvas.bbox(source.id)
284 dx, dy = x2-x1, y2-y1
285 self.dndid = self.canvas.create_rectangle(x, y, x+dx, y+dy)
286 self.dnd_motion(source, event)
287
288 def dnd_motion(self, source, event):
289 x, y = source.where(self.canvas, event)
290 x1, y1, x2, y2 = self.canvas.bbox(self.dndid)
291 self.canvas.move(self.dndid, x-x1, y-y1)
292
293 def dnd_leave(self, source, event):
294 self.top.focus_set() # Hide highlight border
295 self.canvas.delete(self.dndid)
296 self.dndid = None
297
298 def dnd_commit(self, source, event):
299 self.dnd_leave(source, event)
300 x, y = source.where(self.canvas, event)
301 source.attach(self.canvas, x, y)
302
303
304def test():

Callers 1

testFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…