MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / pen

Method pen

tools/python-3.11.9-amd64/Lib/turtle.py:2337–2460  ·  view source on GitHub ↗

Return or set the pen's attributes. Arguments: pen -- a dictionary with some or all of the below listed keys. **pendict -- one or more keyword-arguments with the below listed keys as keywords. Return or set the pen's attribute

(self, pen=None, **pendict)

Source from the content-addressed store, hash-verified

2335 return self._shown
2336
2337 def pen(self, pen=None, **pendict):
2338 """Return or set the pen's attributes.
2339
2340 Arguments:
2341 pen -- a dictionary with some or all of the below listed keys.
2342 **pendict -- one or more keyword-arguments with the below
2343 listed keys as keywords.
2344
2345 Return or set the pen's attributes in a 'pen-dictionary'
2346 with the following key/value pairs:
2347 "shown" : True/False
2348 "pendown" : True/False
2349 "pencolor" : color-string or color-tuple
2350 "fillcolor" : color-string or color-tuple
2351 "pensize" : positive number
2352 "speed" : number in range 0..10
2353 "resizemode" : "auto" or "user" or "noresize"
2354 "stretchfactor": (positive number, positive number)
2355 "shearfactor": number
2356 "outline" : positive number
2357 "tilt" : number
2358
2359 This dictionary can be used as argument for a subsequent
2360 pen()-call to restore the former pen-state. Moreover one
2361 or more of these attributes can be provided as keyword-arguments.
2362 This can be used to set several pen attributes in one statement.
2363
2364
2365 Examples (for a Turtle instance named turtle):
2366 >>> turtle.pen(fillcolor="black", pencolor="red", pensize=10)
2367 >>> turtle.pen()
2368 {'pensize': 10, 'shown': True, 'resizemode': 'auto', 'outline': 1,
2369 'pencolor': 'red', 'pendown': True, 'fillcolor': 'black',
2370 'stretchfactor': (1,1), 'speed': 3, 'shearfactor': 0.0}
2371 >>> penstate=turtle.pen()
2372 >>> turtle.color("yellow","")
2373 >>> turtle.penup()
2374 >>> turtle.pen()
2375 {'pensize': 10, 'shown': True, 'resizemode': 'auto', 'outline': 1,
2376 'pencolor': 'yellow', 'pendown': False, 'fillcolor': '',
2377 'stretchfactor': (1,1), 'speed': 3, 'shearfactor': 0.0}
2378 >>> p.pen(penstate, fillcolor="green")
2379 >>> p.pen()
2380 {'pensize': 10, 'shown': True, 'resizemode': 'auto', 'outline': 1,
2381 'pencolor': 'red', 'pendown': True, 'fillcolor': 'green',
2382 'stretchfactor': (1,1), 'speed': 3, 'shearfactor': 0.0}
2383 """
2384 _pd = {"shown" : self._shown,
2385 "pendown" : self._drawing,
2386 "pencolor" : self._pencolor,
2387 "fillcolor" : self._fillcolor,
2388 "pensize" : self._pensize,
2389 "speed" : self._speed,
2390 "resizemode" : self._resizemode,
2391 "stretchfactor" : self._stretchfactor,
2392 "shearfactor" : self._shearfactor,
2393 "outline" : self._outlinewidth,
2394 "tilt" : self._tilt

Callers 15

resizemodeMethod · 0.95
pensizeMethod · 0.95
penupMethod · 0.95
pendownMethod · 0.95
speedMethod · 0.95
colorMethod · 0.95
pencolorMethod · 0.95
fillcolorMethod · 0.95
showturtleMethod · 0.95
hideturtleMethod · 0.95
shapesizeMethod · 0.80
shearfactorMethod · 0.80

Calls 5

_colorstrMethod · 0.95
_newLineMethod · 0.95
_updateMethod · 0.95
updateMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected