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

Method mode

Lib/turtle.py:1025–1057  ·  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 'world

(self, mode=None)

Source from the content-addressed store, hash-verified

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