diff options
author | Yngve Mardal Moe <yngve.m.moe@gmail.com> | 2024-09-13 04:36:17 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-13 04:36:17 (GMT) |
commit | 584cdf8d4140406b3676515332a26c856c02618b (patch) | |
tree | 191ba92449ef3f857d841a0740ef3376f7db910c /Doc/library/turtle.rst | |
parent | 1f9d163850c43ba85193ef853986c5e96b168c8c (diff) | |
download | cpython-584cdf8d4140406b3676515332a26c856c02618b.zip cpython-584cdf8d4140406b3676515332a26c856c02618b.tar.gz cpython-584cdf8d4140406b3676515332a26c856c02618b.tar.bz2 |
gh-123614: Add save function to turtle.py (#123617)
Diffstat (limited to 'Doc/library/turtle.rst')
-rw-r--r-- | Doc/library/turtle.rst | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/Doc/library/turtle.rst b/Doc/library/turtle.rst index afda368..da801d4 100644 --- a/Doc/library/turtle.rst +++ b/Doc/library/turtle.rst @@ -427,6 +427,7 @@ Input methods Methods specific to Screen | :func:`bye` | :func:`exitonclick` + | :func:`save` | :func:`setup` | :func:`title` @@ -2269,6 +2270,24 @@ Methods specific to Screen, not inherited from TurtleScreen client script. +.. function:: save(filename, overwrite=False) + + Save the current turtle drawing (and turtles) as a PostScript file. + + :param filename: the path of the saved PostScript file + :param overwrite: if ``False`` and there already exists a file with the given + filename, then the function will raise a + ``FileExistsError``. If it is ``True``, the file will be + overwritten. + + .. doctest:: + :skipif: _tkinter is None + + >>> screen.save("my_drawing.ps") + >>> screen.save("my_drawing.ps", overwrite=True) + + .. versionadded:: 3.14 + .. function:: setup(width=_CFG["width"], height=_CFG["height"], startx=_CFG["leftright"], starty=_CFG["topbottom"]) Set the size and position of the main window. Default values of arguments |