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

Method _cc

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

Convert colortriples to hexstrings.

(self, args)

Source from the content-addressed store, hash-verified

2697 return self.screen._colorstr(args)
2698
2699 def _cc(self, args):
2700 """Convert colortriples to hexstrings.
2701 """
2702 if isinstance(args, str):
2703 return args
2704 try:
2705 r, g, b = args
2706 except (TypeError, ValueError):
2707 raise TurtleGraphicsError("bad color arguments: %s" % str(args))
2708 if self.screen._colormode == 1.0:
2709 r, g, b = [round(255.0*x) for x in (r, g, b)]
2710 if not ((0 <= r <= 255) and (0 <= g <= 255) and (0 <= b <= 255)):
2711 raise TurtleGraphicsError("bad color sequence: %s" % str(args))
2712 return "#%02x%02x%02x" % (r, g, b)
2713
2714 def clone(self):
2715 """Create and return a clone of the turtle.

Callers 2

_drawturtleMethod · 0.95
stampMethod · 0.95

Calls 2

TurtleGraphicsErrorClass · 0.85
strFunction · 0.85

Tested by

no test coverage detected