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

Method draw

tools/python-3.11.9-amd64/Lib/idlelib/tree.py:200–240  ·  view source on GitHub ↗
(self, x, y)

Source from the content-addressed store, hash-verified

198 self.canvas['cursor'] = oldcursor
199
200 def draw(self, x, y):
201 # XXX This hard-codes too many geometry constants!
202 dy = 20
203 self.x, self.y = x, y
204 self.drawicon()
205 self.drawtext()
206 if self.state != 'expanded':
207 return y + dy
208 # draw children
209 if not self.children:
210 sublist = self.item._GetSubList()
211 if not sublist:
212 # _IsExpandable() was mistaken; that's allowed
213 return y+17
214 for item in sublist:
215 child = self.__class__(self.canvas, self, item)
216 self.children.append(child)
217 cx = x+20
218 cy = y + dy
219 cylast = 0
220 for child in self.children:
221 cylast = cy
222 self.canvas.create_line(x+9, cy+7, cx, cy+7, fill="gray50")
223 cy = child.draw(cx, cy)
224 if child.item._IsExpandable():
225 if child.state == 'expanded':
226 iconname = "minusnode"
227 callback = child.collapse
228 else:
229 iconname = "plusnode"
230 callback = child.expand
231 image = self.geticonimage(iconname)
232 id = self.canvas.create_image(x+9, cylast+7, image=image)
233 # XXX This leaks bindings until canvas is deleted:
234 self.canvas.tag_bind(id, "<1>", callback)
235 self.canvas.tag_bind(id, "<Double-1>", lambda x: None)
236 id = self.canvas.create_line(x+9, y+10, x+9, cylast+7,
237 ##stipple="gray50", # XXX Seems broken in Tk 8.0.x
238 fill="gray50")
239 self.canvas.tag_lower(id) # XXX .lower(id) before Python 1.5.2
240 return cy
241
242 def drawicon(self):
243 if self.selected:

Callers 1

updateMethod · 0.95

Calls 11

drawiconMethod · 0.95
drawtextMethod · 0.95
geticonimageMethod · 0.95
create_lineMethod · 0.80
_IsExpandableMethod · 0.80
create_imageMethod · 0.80
_GetSubListMethod · 0.45
__class__Method · 0.45
appendMethod · 0.45
tag_bindMethod · 0.45
tag_lowerMethod · 0.45

Tested by

no test coverage detected