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

Method colormode

Lib/turtle.py:1172–1191  ·  view source on GitHub ↗

Return the colormode or set it to 1.0 or 255. Optional argument: cmode -- one of the values 1.0 or 255 r, g, b values of colortriples have to be in range 0..cmode. Example (for a TurtleScreen instance named screen): >>> screen.colormode() 1.0

(self, cmode=None)

Source from the content-addressed store, hash-verified

1170 return tuple(c * self._colormode/255 for c in cl)
1171
1172 def colormode(self, cmode=None):
1173 """Return the colormode or set it to 1.0 or 255.
1174
1175 Optional argument:
1176 cmode -- one of the values 1.0 or 255
1177
1178 r, g, b values of colortriples have to be in range 0..cmode.
1179
1180 Example (for a TurtleScreen instance named screen):
1181 >>> screen.colormode()
1182 1.0
1183 >>> screen.colormode(255)
1184 >>> pencolor(240,160,80)
1185 """
1186 if cmode is None:
1187 return self._colormode
1188 if cmode == 1.0:
1189 self._colormode = float(cmode)
1190 elif cmode == 255:
1191 self._colormode = int(cmode)
1192
1193 def reset(self):
1194 """Reset all Turtles on the Screen to their initial state.

Callers 1

__init__Method · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected