Draw a dot with diameter size, using color. Optional arguments: size -- an integer >= 1 (if given) color -- a colorstring or a numeric color tuple Draw a circular dot with diameter size, using color. If size is not given, the maximum of pensize+4 and 2*pensi
(self, size=None, *color)
| 3484 | self._update() |
| 3485 | |
| 3486 | def dot(self, size=None, *color): |
| 3487 | """Draw a dot with diameter size, using color. |
| 3488 | |
| 3489 | Optional arguments: |
| 3490 | size -- an integer >= 1 (if given) |
| 3491 | color -- a colorstring or a numeric color tuple |
| 3492 | |
| 3493 | Draw a circular dot with diameter size, using color. |
| 3494 | If size is not given, the maximum of pensize+4 and 2*pensize is used. |
| 3495 | |
| 3496 | Example (for a Turtle instance named turtle): |
| 3497 | >>> turtle.dot() |
| 3498 | >>> turtle.fd(50); turtle.dot(20, "blue"); turtle.fd(50) |
| 3499 | """ |
| 3500 | if not color: |
| 3501 | if isinstance(size, (str, tuple)): |
| 3502 | color = self._colorstr(size) |
| 3503 | size = self._pensize + max(self._pensize, 4) |
| 3504 | else: |
| 3505 | color = self._pencolor |
| 3506 | if not size: |
| 3507 | size = self._pensize + max(self._pensize, 4) |
| 3508 | else: |
| 3509 | if size is None: |
| 3510 | size = self._pensize + max(self._pensize, 4) |
| 3511 | color = self._colorstr(color) |
| 3512 | # If screen were to gain a dot function, see GH #104218. |
| 3513 | pen = self.pen() |
| 3514 | if self.undobuffer: |
| 3515 | self.undobuffer.push(["seq"]) |
| 3516 | self.undobuffer.cumulate = True |
| 3517 | try: |
| 3518 | if self.resizemode() == 'auto': |
| 3519 | self.ht() |
| 3520 | self.pendown() |
| 3521 | self.pensize(size) |
| 3522 | self.pencolor(color) |
| 3523 | self.forward(0) |
| 3524 | finally: |
| 3525 | self.pen(pen) |
| 3526 | if self.undobuffer: |
| 3527 | self.undobuffer.cumulate = False |
| 3528 | |
| 3529 | def _write(self, txt, align, font): |
| 3530 | """Performs the writing for write() |