Convert colortriples to hexstrings.
(self, args)
| 2595 | return self.screen._colorstr(args) |
| 2596 | |
| 2597 | def _cc(self, args): |
| 2598 | """Convert colortriples to hexstrings. |
| 2599 | """ |
| 2600 | if isinstance(args, str): |
| 2601 | return args |
| 2602 | try: |
| 2603 | r, g, b = args |
| 2604 | except (TypeError, ValueError): |
| 2605 | raise TurtleGraphicsError("bad color arguments: %s" % str(args)) |
| 2606 | if self.screen._colormode == 1.0: |
| 2607 | r, g, b = [round(255.0*x) for x in (r, g, b)] |
| 2608 | if not ((0 <= r <= 255) and (0 <= g <= 255) and (0 <= b <= 255)): |
| 2609 | raise TurtleGraphicsError("bad color sequence: %s" % str(args)) |
| 2610 | return "#%02x%02x%02x" % (r, g, b) |
| 2611 | |
| 2612 | def clone(self): |
| 2613 | """Create and return a clone of the turtle. |
no test coverage detected