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

Method mode

tools/python-3.11.9-amd64/Lib/turtle.py:1035–1067  ·  view source on GitHub ↗

Set turtle-mode ('standard', 'logo' or 'world') and perform reset. Optional argument: mode -- one of the strings 'standard', 'logo' or 'world' Mode 'standard' is compatible with turtle.py. Mode 'logo' is compatible with most Logo-Turtle-Graphics. Mode

(self, mode=None)

Source from the content-addressed store, hash-verified

1033 Turtle._pen = None
1034
1035 def mode(self, mode=None):
1036 """Set turtle-mode ('standard', 'logo' or 'world') and perform reset.
1037
1038 Optional argument:
1039 mode -- one of the strings 'standard', 'logo' or 'world'
1040
1041 Mode 'standard' is compatible with turtle.py.
1042 Mode 'logo' is compatible with most Logo-Turtle-Graphics.
1043 Mode 'world' uses userdefined 'worldcoordinates'. *Attention*: in
1044 this mode angles appear distorted if x/y unit-ratio doesn't equal 1.
1045 If mode is not given, return the current mode.
1046
1047 Mode Initial turtle heading positive angles
1048 ------------|-------------------------|-------------------
1049 'standard' to the right (east) counterclockwise
1050 'logo' upward (north) clockwise
1051
1052 Examples:
1053 >>> mode('logo') # resets turtle heading to north
1054 >>> mode()
1055 'logo'
1056 """
1057 if mode is None:
1058 return self._mode
1059 mode = mode.lower()
1060 if mode not in ["standard", "logo", "world"]:
1061 raise TurtleGraphicsError("No turtle-graphics-mode %s" % mode)
1062 self._mode = mode
1063 if mode in ["standard", "logo"]:
1064 self._setscrollregion(-self.canvwidth//2, -self.canvheight//2,
1065 self.canvwidth//2, self.canvheight//2)
1066 self.xscale = self.yscale = 1.0
1067 self.reset()
1068
1069 def setworldcoordinates(self, llx, lly, urx, ury):
1070 """Set up a user defined coordinate-system.

Callers 2

setworldcoordinatesMethod · 0.95
__init__Method · 0.45

Calls 4

resetMethod · 0.95
TurtleGraphicsErrorClass · 0.85
_setscrollregionMethod · 0.80
lowerMethod · 0.45

Tested by

no test coverage detected