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

Method attach

Lib/tkinter/dnd.py:214–228  ·  view source on GitHub ↗
(self, canvas, x=10, y=10)

Source from the content-addressed store, hash-verified

212 self.canvas = self.label = self.id = None
213
214 def attach(self, canvas, x=10, y=10):
215 if canvas is self.canvas:
216 self.canvas.coords(self.id, x, y)
217 return
218 if self.canvas is not None:
219 self.detach()
220 if canvas is None:
221 return
222 label = tkinter.Label(canvas, text=self.name,
223 borderwidth=2, relief="raised")
224 id = canvas.create_window(x, y, window=label, anchor="nw")
225 self.canvas = canvas
226 self.label = label
227 self.id = id
228 label.bind("<ButtonPress>", self.press)
229
230 def detach(self):
231 canvas = self.canvas

Calls 4

detachMethod · 0.95
create_windowMethod · 0.80
coordsMethod · 0.45
bindMethod · 0.45