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

Method clear

Lib/turtle.py:995–1023  ·  view source on GitHub ↗

Delete all drawings and all turtles from the TurtleScreen. No argument. Reset empty TurtleScreen to its initial state: white background, no backgroundimage, no eventbindings and tracing on. Example (for a TurtleScreen instance named screen): >>> screen.clea

(self)

Source from the content-addressed store, hash-verified

993 rootwindow.call('wm', 'attributes', '.', '-topmost', '0')
994
995 def clear(self):
996 """Delete all drawings and all turtles from the TurtleScreen.
997
998 No argument.
999
1000 Reset empty TurtleScreen to its initial state: white background,
1001 no backgroundimage, no eventbindings and tracing on.
1002
1003 Example (for a TurtleScreen instance named screen):
1004 >>> screen.clear()
1005
1006 Note: this method is not available as function.
1007 """
1008 self._delayvalue = _CFG["delay"]
1009 self._colormode = _CFG["colormode"]
1010 self._delete("all")
1011 self._bgpic = self._createimage("")
1012 self._bgpicname = "nopic"
1013 self._tracing = 1
1014 self._updatecounter = 0
1015 self._turtles = []
1016 self.bgcolor("white")
1017 for btn in 1, 2, 3:
1018 self.onclick(None, btn)
1019 self.onkeypress(None)
1020 for key in self._keys[:]:
1021 self.onkey(None, key)
1022 self.onkeypress(None, key)
1023 Turtle._pen = None
1024
1025 def mode(self, mode=None):
1026 """Set turtle-mode ('standard', 'logo' or 'world') and perform reset.

Callers 1

__init__Method · 0.95

Calls 6

bgcolorMethod · 0.95
onclickMethod · 0.95
onkeypressMethod · 0.95
onkeyMethod · 0.95
_createimageMethod · 0.80
_deleteMethod · 0.45

Tested by

no test coverage detected