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

Method loadfile

Lib/turtledemo/__main__.py:330–343  ·  view source on GitHub ↗
(self, filename)

Source from the content-addressed store, hash-verified

328 self.dirty=False
329
330 def loadfile(self, filename):
331 self.clearCanvas()
332 turtle.TurtleScreen._RUNNING = False
333 modname = 'turtledemo.' + filename
334 __import__(modname)
335 self.module = sys.modules[modname]
336 with open(self.module.__file__, 'r') as f:
337 chars = f.read()
338 self.text.delete("1.0", "end")
339 self.text.insert("1.0", chars)
340 self.root.title(filename + " - a Python turtle graphics example")
341 self.configGUI(NORMAL, DISABLED, DISABLED,
342 "Press start button", "red")
343 self.state = READY
344
345 def startDemo(self):
346 self.refreshCanvas()

Callers 2

__init__Method · 0.95
loadMethod · 0.95

Calls 8

clearCanvasMethod · 0.95
configGUIMethod · 0.95
__import__Function · 0.85
openFunction · 0.50
readMethod · 0.45
deleteMethod · 0.45
insertMethod · 0.45
titleMethod · 0.45

Tested by

no test coverage detected