MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / mouse_up

Method mouse_up

tools/python-3.11.9-amd64/Tools/demo/sortvisu.py:227–239  ·  view source on GitHub ↗
(self, event)

Source from the content-addressed store, hash-verified

225 self.lasty = event.y
226
227 def mouse_up(self, event):
228 i = self.nearestindex(event.x)
229 if i >= self.array.getsize():
230 i = self.array.getsize() - 1
231 if i < 0:
232 i = 0
233 other = self.array.items[i]
234 here = self.index
235 self.array.items[here], self.array.items[i] = other, self
236 self.index = i
237 x1, y1, x2, y2 = self.position()
238 self.canvas.coords(self.item_id, (x1, y1, x2, y2))
239 other.setindex(here)
240
241 def setindex(self, index):
242 nsteps = steps(self.index, index)

Callers

nothing calls this directly

Calls 5

nearestindexMethod · 0.95
positionMethod · 0.95
setindexMethod · 0.80
getsizeMethod · 0.45
coordsMethod · 0.45

Tested by

no test coverage detected