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
(self, size=None, *color)
| 3366 | self._update() |
| 3367 | |
| 3368 | def dot(self, size=None, *color): |
| 3369 | """Draw a dot with diameter size, using color. |
| 3370 | |
| 3371 | Optional arguments: |
| 3372 | size -- an integer >= 1 (if given) |
| 3373 | color -- a colorstring or a numeric color tuple |
| 3374 | |
| 3375 | Draw a circular dot with diameter size, using color. |
| 3376 | If size is not given, the maximum of pensize+4 and 2*pensize is used. |
| 3377 | |
| 3378 | Example (for a Turtle instance named turtle): |
| 3379 | >>> turtle.dot() |
| 3380 | >>> turtle.fd(50); turtle.dot(20, "blue"); turtle.fd(50) |
| 3381 | """ |
| 3382 | if not color: |
| 3383 | if isinstance(size, (str, tuple)): |
| 3384 | color = self._colorstr(size) |
| 3385 | size = self._pensize + max(self._pensize, 4) |
| 3386 | else: |
| 3387 | color = self._pencolor |
| 3388 | if not size: |
| 3389 | size = self._pensize + max(self._pensize, 4) |
| 3390 | else: |
| 3391 | if size is None: |
| 3392 | size = self._pensize + max(self._pensize, 4) |
| 3393 | color = self._colorstr(color) |
| 3394 | if hasattr(self.screen, "_dot"): |
| 3395 | item = self.screen._dot(self._position, size, color) |
| 3396 | self.items.append(item) |
| 3397 | if self.undobuffer: |
| 3398 | self.undobuffer.push(("dot", item)) |
| 3399 | else: |
| 3400 | pen = self.pen() |
| 3401 | if self.undobuffer: |
| 3402 | self.undobuffer.push(["seq"]) |
| 3403 | self.undobuffer.cumulate = True |
| 3404 | try: |
| 3405 | if self.resizemode() == 'auto': |
| 3406 | self.ht() |
| 3407 | self.pendown() |
| 3408 | self.pensize(size) |
| 3409 | self.pencolor(color) |
| 3410 | self.forward(0) |
| 3411 | finally: |
| 3412 | self.pen(pen) |
| 3413 | if self.undobuffer: |
| 3414 | self.undobuffer.cumulate = False |
| 3415 | |
| 3416 | def _write(self, txt, align, font): |
| 3417 | """Performs the writing for write() |