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)
| 3248 | self._update() |
| 3249 | |
| 3250 | def dot(self, size=None, *color): |
| 3251 | """Draw a dot with diameter size, using color. |
| 3252 | |
| 3253 | Optional arguments: |
| 3254 | size -- an integer >= 1 (if given) |
| 3255 | color -- a colorstring or a numeric color tuple |
| 3256 | |
| 3257 | Draw a circular dot with diameter size, using color. |
| 3258 | If size is not given, the maximum of pensize+4 and 2*pensize is used. |
| 3259 | |
| 3260 | Example (for a Turtle instance named turtle): |
| 3261 | >>> turtle.dot() |
| 3262 | >>> turtle.fd(50); turtle.dot(20, "blue"); turtle.fd(50) |
| 3263 | """ |
| 3264 | if not color: |
| 3265 | if isinstance(size, (str, tuple)): |
| 3266 | color = self._colorstr(size) |
| 3267 | size = self._pensize + max(self._pensize, 4) |
| 3268 | else: |
| 3269 | color = self._pencolor |
| 3270 | if not size: |
| 3271 | size = self._pensize + max(self._pensize, 4) |
| 3272 | else: |
| 3273 | if size is None: |
| 3274 | size = self._pensize + max(self._pensize, 4) |
| 3275 | color = self._colorstr(color) |
| 3276 | if hasattr(self.screen, "_dot"): |
| 3277 | item = self.screen._dot(self._position, size, color) |
| 3278 | self.items.append(item) |
| 3279 | if self.undobuffer: |
| 3280 | self.undobuffer.push(("dot", item)) |
| 3281 | else: |
| 3282 | pen = self.pen() |
| 3283 | if self.undobuffer: |
| 3284 | self.undobuffer.push(["seq"]) |
| 3285 | self.undobuffer.cumulate = True |
| 3286 | try: |
| 3287 | if self.resizemode() == 'auto': |
| 3288 | self.ht() |
| 3289 | self.pendown() |
| 3290 | self.pensize(size) |
| 3291 | self.pencolor(color) |
| 3292 | self.forward(0) |
| 3293 | finally: |
| 3294 | self.pen(pen) |
| 3295 | if self.undobuffer: |
| 3296 | self.undobuffer.cumulate = False |
| 3297 | |
| 3298 | def _write(self, txt, align, font): |
| 3299 | """Performs the writing for write() |