Convert colortriples to hexstrings.
(self, args)
| 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. |
no test coverage detected