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

Method clear

tools/python-3.11.9-amd64/Lib/turtle.py:1005–1033  ·  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): >>> scr

(self)

Source from the content-addressed store, hash-verified

1003 rootwindow.call('wm', 'attributes', '.', '-topmost', '0')
1004
1005 def clear(self):
1006 """Delete all drawings and all turtles from the TurtleScreen.
1007
1008 No argument.
1009
1010 Reset empty TurtleScreen to its initial state: white background,
1011 no backgroundimage, no eventbindings and tracing on.
1012
1013 Example (for a TurtleScreen instance named screen):
1014 >>> screen.clear()
1015
1016 Note: this method is not available as function.
1017 """
1018 self._delayvalue = _CFG["delay"]
1019 self._colormode = _CFG["colormode"]
1020 self._delete("all")
1021 self._bgpic = self._createimage("")
1022 self._bgpicname = "nopic"
1023 self._tracing = 1
1024 self._updatecounter = 0
1025 self._turtles = []
1026 self.bgcolor("white")
1027 for btn in 1, 2, 3:
1028 self.onclick(None, btn)
1029 self.onkeypress(None)
1030 for key in self._keys[:]:
1031 self.onkey(None, key)
1032 self.onkeypress(None, key)
1033 Turtle._pen = None
1034
1035 def mode(self, mode=None):
1036 """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