Return or set the fillcolor. Arguments: Four input formats are allowed: - fillcolor() Return the current fillcolor as color specification string, possibly in tuple format (see example). May be used as input to another color/pencolor/fi
(self, *args)
| 2327 | return self._color(self._pencolor) |
| 2328 | |
| 2329 | def fillcolor(self, *args): |
| 2330 | """ Return or set the fillcolor. |
| 2331 | |
| 2332 | Arguments: |
| 2333 | Four input formats are allowed: |
| 2334 | - fillcolor() |
| 2335 | Return the current fillcolor as color specification string, |
| 2336 | possibly in tuple format (see example). May be used as |
| 2337 | input to another color/pencolor/fillcolor/bgcolor call. |
| 2338 | - fillcolor(colorstring) |
| 2339 | Set fillcolor to colorstring, which is a Tk color |
| 2340 | specification string, such as "red", "yellow", or "#33cc8c". |
| 2341 | - fillcolor((r, g, b)) |
| 2342 | Set fillcolor to the RGB color represented by the tuple of |
| 2343 | r, g, and b. Each of r, g, and b must be in the range |
| 2344 | 0..colormode, where colormode is either 1.0 or 255 (see |
| 2345 | colormode()). |
| 2346 | - fillcolor(r, g, b) |
| 2347 | Set fillcolor to the RGB color represented by r, g, and b. |
| 2348 | Each of r, g, and b must be in the range 0..colormode. |
| 2349 | |
| 2350 | If turtleshape is a polygon, the interior of that polygon is drawn |
| 2351 | with the newly set fillcolor. |
| 2352 | |
| 2353 | Example (for a Turtle instance named turtle): |
| 2354 | >>> turtle.fillcolor('violet') |
| 2355 | >>> turtle.fillcolor() |
| 2356 | 'violet' |
| 2357 | >>> colormode(255) |
| 2358 | >>> turtle.fillcolor('#ffffff') |
| 2359 | >>> turtle.fillcolor() |
| 2360 | (255.0, 255.0, 255.0) |
| 2361 | """ |
| 2362 | if args: |
| 2363 | color = self._colorstr(args) |
| 2364 | if color == self._fillcolor: |
| 2365 | return |
| 2366 | self.pen(fillcolor=color) |
| 2367 | else: |
| 2368 | return self._color(self._fillcolor) |
| 2369 | |
| 2370 | def teleport(self, x=None, y=None, *, fill_gap: bool = False) -> None: |
| 2371 | """To be overwritten by child class RawTurtle. |