MCPcopy Index your code
hub / github.com/python/cpython / fillcolor

Method fillcolor

Lib/turtle.py:2329–2368  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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.

Callers 6

__init__Method · 0.80
glowMethod · 0.80
unglowMethod · 0.80
shiftMethod · 0.80
__init__Method · 0.80
mainFunction · 0.80

Calls 3

_colorstrMethod · 0.95
penMethod · 0.95
_colorMethod · 0.95

Tested by

no test coverage detected