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

Method drawtext

tools/python-3.11.9-amd64/Lib/idlelib/tree.py:255–291  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

253 self.canvas.tag_bind(id, "<Double-1>", self.flip)
254
255 def drawtext(self):
256 textx = self.x+20-1
257 texty = self.y-4
258 labeltext = self.item.GetLabelText()
259 if labeltext:
260 id = self.canvas.create_text(textx, texty, anchor="nw",
261 text=labeltext)
262 self.canvas.tag_bind(id, "<1>", self.select)
263 self.canvas.tag_bind(id, "<Double-1>", self.flip)
264 x0, y0, x1, y1 = self.canvas.bbox(id)
265 textx = max(x1, 200) + 10
266 text = self.item.GetText() or "<no text>"
267 try:
268 self.entry
269 except AttributeError:
270 pass
271 else:
272 self.edit_finish()
273 try:
274 self.label
275 except AttributeError:
276 # padding carefully selected (on Windows) to match Entry widget:
277 self.label = Label(self.canvas, text=text, bd=0, padx=2, pady=2)
278 theme = idleConf.CurrentTheme()
279 if self.selected:
280 self.label.configure(idleConf.GetHighlight(theme, 'hilite'))
281 else:
282 self.label.configure(idleConf.GetHighlight(theme, 'normal'))
283 id = self.canvas.create_window(textx, texty,
284 anchor="nw", window=self.label)
285 self.label.bind("<1>", self.select_or_edit)
286 self.label.bind("<Double-1>", self.flip)
287 self.label.bind("<MouseWheel>", lambda e: wheel_event(e, self.canvas))
288 if self.label._windowingsystem == 'x11':
289 self.label.bind("<Button-4>", lambda e: wheel_event(e, self.canvas))
290 self.label.bind("<Button-5>", lambda e: wheel_event(e, self.canvas))
291 self.text_id = id
292
293 def select_or_edit(self, event=None):
294 if self.selected and self.item.IsEditable():

Callers 5

selectMethod · 0.95
deselectMethod · 0.95
drawMethod · 0.95
edit_finishMethod · 0.95
edit_cancelMethod · 0.95

Calls 14

edit_finishMethod · 0.95
maxFunction · 0.85
wheel_eventFunction · 0.85
create_textMethod · 0.80
CurrentThemeMethod · 0.80
GetHighlightMethod · 0.80
create_windowMethod · 0.80
LabelClass · 0.50
GetLabelTextMethod · 0.45
tag_bindMethod · 0.45
bboxMethod · 0.45
GetTextMethod · 0.45

Tested by

no test coverage detected