Linux ip-148-66-134-25.ip.secureserver.net 3.10.0-1160.119.1.el7.tuxcare.els11.x86_64 #1 SMP Sun Nov 3 09:06:59 UTC 2024 x86_64
Apache
: 148.66.134.25 | : 3.135.194.138
66 Domain
8.0.30
amvm
www.github.com/MadExploits
Terminal
AUTO ROOT
Adminer
Backdoor Destroyer
Linux Exploit
Lock Shell
Lock File
Create User
CREATE RDP
PHP Mailer
BACKCONNECT
UNLOCK SHELL
HASH IDENTIFIER
CPANEL RESET
BLACK DEFEND!
README
+ Create Folder
+ Create File
/
usr /
share /
doc /
python-docs-2.7.5 /
html /
library /
[ HOME SHELL ]
Name
Size
Permission
Action
2to3.html
49.27
KB
-rw-r--r--
__builtin__.html
10.26
KB
-rw-r--r--
__future__.html
13.79
KB
-rw-r--r--
__main__.html
7.05
KB
-rw-r--r--
_winreg.html
59.21
KB
-rw-r--r--
abc.html
23.9
KB
-rw-r--r--
aepack.html
13.16
KB
-rw-r--r--
aetools.html
14.91
KB
-rw-r--r--
aetypes.html
18.88
KB
-rw-r--r--
aifc.html
22.4
KB
-rw-r--r--
al.html
17.34
KB
-rw-r--r--
allos.html
33.72
KB
-rw-r--r--
anydbm.html
16.33
KB
-rw-r--r--
archiving.html
9.26
KB
-rw-r--r--
argparse.html
237.62
KB
-rw-r--r--
array.html
29.29
KB
-rw-r--r--
ast.html
34.98
KB
-rw-r--r--
asynchat.html
31.43
KB
-rw-r--r--
asyncore.html
36.51
KB
-rw-r--r--
atexit.html
16.8
KB
-rw-r--r--
audioop.html
31.36
KB
-rw-r--r--
autogil.html
8.19
KB
-rw-r--r--
base64.html
19.67
KB
-rw-r--r--
basehttpserver.html
34.04
KB
-rw-r--r--
bastion.html
11.04
KB
-rw-r--r--
bdb.html
36.68
KB
-rw-r--r--
binascii.html
20.67
KB
-rw-r--r--
binhex.html
10.58
KB
-rw-r--r--
bisect.html
23.24
KB
-rw-r--r--
bsddb.html
26.43
KB
-rw-r--r--
bz2.html
26.08
KB
-rw-r--r--
calendar.html
37.79
KB
-rw-r--r--
carbon.html
48.94
KB
-rw-r--r--
cd.html
27.96
KB
-rw-r--r--
cgi.html
49.92
KB
-rw-r--r--
cgihttpserver.html
13.1
KB
-rw-r--r--
cgitb.html
11.41
KB
-rw-r--r--
chunk.html
14.66
KB
-rw-r--r--
cmath.html
25.63
KB
-rw-r--r--
cmd.html
26.09
KB
-rw-r--r--
code.html
24.58
KB
-rw-r--r--
codecs.html
100.64
KB
-rw-r--r--
codeop.html
14.84
KB
-rw-r--r--
collections.html
133.96
KB
-rw-r--r--
colorpicker.html
7.52
KB
-rw-r--r--
colorsys.html
11.04
KB
-rw-r--r--
commands.html
14.36
KB
-rw-r--r--
compileall.html
16.83
KB
-rw-r--r--
compiler.html
67.75
KB
-rw-r--r--
configparser.html
62.13
KB
-rw-r--r--
constants.html
12.83
KB
-rw-r--r--
contextlib.html
19.39
KB
-rw-r--r--
cookie.html
39.07
KB
-rw-r--r--
cookielib.html
83.82
KB
-rw-r--r--
copy.html
12.19
KB
-rw-r--r--
copy_reg.html
13.76
KB
-rw-r--r--
crypt.html
10.04
KB
-rw-r--r--
crypto.html
7.59
KB
-rw-r--r--
csv.html
67.37
KB
-rw-r--r--
ctypes.html
238.78
KB
-rw-r--r--
curses.ascii.html
22.29
KB
-rw-r--r--
curses.html
146.63
KB
-rw-r--r--
curses.panel.html
14.39
KB
-rw-r--r--
custominterp.html
7.62
KB
-rw-r--r--
datatypes.html
16.84
KB
-rw-r--r--
datetime.html
226.59
KB
-rw-r--r--
dbhash.html
15.48
KB
-rw-r--r--
dbm.html
12.07
KB
-rw-r--r--
debug.html
10.15
KB
-rw-r--r--
decimal.html
194.44
KB
-rw-r--r--
development.html
14.17
KB
-rw-r--r--
difflib.html
84.83
KB
-rw-r--r--
dircache.html
11.41
KB
-rw-r--r--
dis.html
69.95
KB
-rw-r--r--
distutils.html
8.05
KB
-rw-r--r--
dl.html
16.33
KB
-rw-r--r--
doctest.html
165.54
KB
-rw-r--r--
docxmlrpcserver.html
16.43
KB
-rw-r--r--
dumbdbm.html
14.02
KB
-rw-r--r--
dummy_thread.html
9.43
KB
-rw-r--r--
dummy_threading.html
8.37
KB
-rw-r--r--
easydialogs.html
30.55
KB
-rw-r--r--
email-examples.html
45.65
KB
-rw-r--r--
email.charset.html
26.8
KB
-rw-r--r--
email.encoders.html
11.86
KB
-rw-r--r--
email.errors.html
15.77
KB
-rw-r--r--
email.generator.html
20.77
KB
-rw-r--r--
email.header.html
26.92
KB
-rw-r--r--
email.html
44.24
KB
-rw-r--r--
email.iterators.html
11.52
KB
-rw-r--r--
email.message.html
63.16
KB
-rw-r--r--
email.mime.html
27.93
KB
-rw-r--r--
email.parser.html
30.45
KB
-rw-r--r--
email.util.html
24.46
KB
-rw-r--r--
errno.html
37.99
KB
-rw-r--r--
exceptions.html
56.13
KB
-rw-r--r--
fcntl.html
22.67
KB
-rw-r--r--
filecmp.html
22.3
KB
-rw-r--r--
fileformats.html
9.14
KB
-rw-r--r--
fileinput.html
24.28
KB
-rw-r--r--
filesys.html
10.2
KB
-rw-r--r--
fl.html
49.92
KB
-rw-r--r--
fm.html
11.91
KB
-rw-r--r--
fnmatch.html
14.58
KB
-rw-r--r--
formatter.html
34.06
KB
-rw-r--r--
fpectl.html
16.01
KB
-rw-r--r--
fpformat.html
10.59
KB
-rw-r--r--
fractions.html
22.61
KB
-rw-r--r--
framework.html
33.34
KB
-rw-r--r--
frameworks.html
7.14
KB
-rw-r--r--
ftplib.html
43.99
KB
-rw-r--r--
functions.html
183.14
KB
-rw-r--r--
functools.html
27.17
KB
-rw-r--r--
future_builtins.html
13.04
KB
-rw-r--r--
gc.html
25.75
KB
-rw-r--r--
gdbm.html
15.96
KB
-rw-r--r--
gensuitemodule.html
11.51
KB
-rw-r--r--
getopt.html
23.66
KB
-rw-r--r--
getpass.html
10.65
KB
-rw-r--r--
gettext.html
78.76
KB
-rw-r--r--
gl.html
22.09
KB
-rw-r--r--
glob.html
13.26
KB
-rw-r--r--
grp.html
10.49
KB
-rw-r--r--
gzip.html
18.99
KB
-rw-r--r--
hashlib.html
18.2
KB
-rw-r--r--
heapq.html
31.61
KB
-rw-r--r--
hmac.html
10.46
KB
-rw-r--r--
hotshot.html
18.65
KB
-rw-r--r--
htmllib.html
25.32
KB
-rw-r--r--
htmlparser.html
39.11
KB
-rw-r--r--
httplib.html
62.95
KB
-rw-r--r--
i18n.html
9.52
KB
-rw-r--r--
ic.html
17.17
KB
-rw-r--r--
idle.html
20.9
KB
-rw-r--r--
imageop.html
14.76
KB
-rw-r--r--
imaplib.html
51.99
KB
-rw-r--r--
imgfile.html
11.71
KB
-rw-r--r--
imghdr.html
11.3
KB
-rw-r--r--
imp.html
34.34
KB
-rw-r--r--
importlib.html
8.26
KB
-rw-r--r--
imputil.html
31.81
KB
-rw-r--r--
index.html
72.78
KB
-rw-r--r--
inspect.html
50.71
KB
-rw-r--r--
internet.html
24.87
KB
-rw-r--r--
intro.html
8.93
KB
-rw-r--r--
io.html
98.13
KB
-rw-r--r--
ipc.html
13.41
KB
-rw-r--r--
itertools.html
115.91
KB
-rw-r--r--
jpeg.html
12.74
KB
-rw-r--r--
json.html
67.04
KB
-rw-r--r--
keyword.html
7.68
KB
-rw-r--r--
language.html
11.03
KB
-rw-r--r--
linecache.html
10.59
KB
-rw-r--r--
locale.html
55.14
KB
-rw-r--r--
logging.config.html
63.36
KB
-rw-r--r--
logging.handlers.html
69.64
KB
-rw-r--r--
logging.html
95.64
KB
-rw-r--r--
mac.html
21.79
KB
-rw-r--r--
macos.html
14.76
KB
-rw-r--r--
macosa.html
12.96
KB
-rw-r--r--
macostools.html
15.52
KB
-rw-r--r--
macpath.html
7.76
KB
-rw-r--r--
mailbox.html
156.75
KB
-rw-r--r--
mailcap.html
13.21
KB
-rw-r--r--
markup.html
18.77
KB
-rw-r--r--
marshal.html
17.98
KB
-rw-r--r--
math.html
39.24
KB
-rw-r--r--
md5.html
13.97
KB
-rw-r--r--
mhlib.html
21.54
KB
-rw-r--r--
mimetools.html
19.25
KB
-rw-r--r--
mimetypes.html
28.39
KB
-rw-r--r--
mimewriter.html
15.02
KB
-rw-r--r--
mimify.html
13.36
KB
-rw-r--r--
miniaeframe.html
12.2
KB
-rw-r--r--
misc.html
6.87
KB
-rw-r--r--
mm.html
9.03
KB
-rw-r--r--
mmap.html
28.36
KB
-rw-r--r--
modulefinder.html
15.31
KB
-rw-r--r--
modules.html
8.46
KB
-rw-r--r--
msilib.html
52.43
KB
-rw-r--r--
msvcrt.html
19.37
KB
-rw-r--r--
multifile.html
24.3
KB
-rw-r--r--
multiprocessing.html
365.71
KB
-rw-r--r--
mutex.html
11.23
KB
-rw-r--r--
netdata.html
16.98
KB
-rw-r--r--
netrc.html
12.3
KB
-rw-r--r--
new.html
12.12
KB
-rw-r--r--
nis.html
10.64
KB
-rw-r--r--
nntplib.html
41.92
KB
-rw-r--r--
numbers.html
37.75
KB
-rw-r--r--
numeric.html
13.55
KB
-rw-r--r--
operator.html
82
KB
-rw-r--r--
optparse.html
222.56
KB
-rw-r--r--
os.html
214.25
KB
-rw-r--r--
os.path.html
38.34
KB
-rw-r--r--
ossaudiodev.html
41.5
KB
-rw-r--r--
othergui.html
9.08
KB
-rw-r--r--
parser.html
39.36
KB
-rw-r--r--
pdb.html
33.96
KB
-rw-r--r--
persistence.html
14.87
KB
-rw-r--r--
pickle.html
102.27
KB
-rw-r--r--
pickletools.html
10.63
KB
-rw-r--r--
pipes.html
18.01
KB
-rw-r--r--
pkgutil.html
25.11
KB
-rw-r--r--
platform.html
28.37
KB
-rw-r--r--
plistlib.html
17.03
KB
-rw-r--r--
popen2.html
25.43
KB
-rw-r--r--
poplib.html
22.32
KB
-rw-r--r--
posix.html
14.41
KB
-rw-r--r--
posixfile.html
19.76
KB
-rw-r--r--
pprint.html
29.92
KB
-rw-r--r--
profile.html
63.56
KB
-rw-r--r--
pty.html
9.48
KB
-rw-r--r--
pwd.html
11.43
KB
-rw-r--r--
py_compile.html
11.12
KB
-rw-r--r--
pyclbr.html
14.71
KB
-rw-r--r--
pydoc.html
11.48
KB
-rw-r--r--
pyexpat.html
71.53
KB
-rw-r--r--
python.html
12.27
KB
-rw-r--r--
queue.html
24.22
KB
-rw-r--r--
quopri.html
11.9
KB
-rw-r--r--
random.html
37.83
KB
-rw-r--r--
re.html
134.74
KB
-rw-r--r--
readline.html
28.24
KB
-rw-r--r--
repr.html
20.43
KB
-rw-r--r--
resource.html
26.48
KB
-rw-r--r--
restricted.html
11.65
KB
-rw-r--r--
rexec.html
37.41
KB
-rw-r--r--
rfc822.html
42.22
KB
-rw-r--r--
rlcompleter.html
13.51
KB
-rw-r--r--
robotparser.html
12.27
KB
-rw-r--r--
runpy.html
19.34
KB
-rw-r--r--
sched.html
18.54
KB
-rw-r--r--
scrolledtext.html
9.32
KB
-rw-r--r--
select.html
39.67
KB
-rw-r--r--
sets.html
36.92
KB
-rw-r--r--
sgi.html
9.71
KB
-rw-r--r--
sgmllib.html
30.77
KB
-rw-r--r--
sha.html
12.09
KB
-rw-r--r--
shelve.html
27.02
KB
-rw-r--r--
shlex.html
32.1
KB
-rw-r--r--
shutil.html
40.22
KB
-rw-r--r--
signal.html
31.14
KB
-rw-r--r--
simplehttpserver.html
18.41
KB
-rw-r--r--
simplexmlrpcserver.html
31.39
KB
-rw-r--r--
site.html
23.64
KB
-rw-r--r--
smtpd.html
12.46
KB
-rw-r--r--
smtplib.html
42.13
KB
-rw-r--r--
sndhdr.html
10.02
KB
-rw-r--r--
socket.html
106.34
KB
-rw-r--r--
socketserver.html
59.83
KB
-rw-r--r--
someos.html
15.11
KB
-rw-r--r--
spwd.html
10.33
KB
-rw-r--r--
sqlite3.html
139.5
KB
-rw-r--r--
ssl.html
65.62
KB
-rw-r--r--
stat.html
32.31
KB
-rw-r--r--
statvfs.html
10.6
KB
-rw-r--r--
stdtypes.html
260.4
KB
-rw-r--r--
string.html
106.65
KB
-rw-r--r--
stringio.html
18.81
KB
-rw-r--r--
stringprep.html
16.13
KB
-rw-r--r--
strings.html
14.93
KB
-rw-r--r--
struct.html
40.88
KB
-rw-r--r--
subprocess.html
84.91
KB
-rw-r--r--
sun.html
6.84
KB
-rw-r--r--
sunau.html
27.1
KB
-rw-r--r--
sunaudio.html
17.79
KB
-rw-r--r--
symbol.html
7.66
KB
-rw-r--r--
symtable.html
22.94
KB
-rw-r--r--
sys.html
98.7
KB
-rw-r--r--
sysconfig.html
23.84
KB
-rw-r--r--
syslog.html
17.92
KB
-rw-r--r--
tabnanny.html
10.63
KB
-rw-r--r--
tarfile.html
78.68
KB
-rw-r--r--
telnetlib.html
25.48
KB
-rw-r--r--
tempfile.html
29.42
KB
-rw-r--r--
termios.html
16.01
KB
-rw-r--r--
test.html
52.62
KB
-rw-r--r--
textwrap.html
27.25
KB
-rw-r--r--
thread.html
20.47
KB
-rw-r--r--
threading.html
76.69
KB
-rw-r--r--
time.html
56.93
KB
-rw-r--r--
timeit.html
36.27
KB
-rw-r--r--
tix.html
46.96
KB
-rw-r--r--
tk.html
23.64
KB
-rw-r--r--
tkinter.html
67.67
KB
-rw-r--r--
token.html
19.62
KB
-rw-r--r--
tokenize.html
18.45
KB
-rw-r--r--
trace.html
25.54
KB
-rw-r--r--
traceback.html
33.44
KB
-rw-r--r--
ttk.html
101.75
KB
-rw-r--r--
tty.html
9.06
KB
-rw-r--r--
turtle.html
211.74
KB
-rw-r--r--
types.html
27.59
KB
-rw-r--r--
undoc.html
23.16
KB
-rw-r--r--
unicodedata.html
18.55
KB
-rw-r--r--
unittest.html
202.85
KB
-rw-r--r--
unix.html
10.55
KB
-rw-r--r--
urllib.html
58.68
KB
-rw-r--r--
urllib2.html
100.58
KB
-rw-r--r--
urlparse.html
40.41
KB
-rw-r--r--
user.html
11.83
KB
-rw-r--r--
userdict.html
29.73
KB
-rw-r--r--
uu.html
11.03
KB
-rw-r--r--
uuid.html
28.19
KB
-rw-r--r--
warnings.html
46.6
KB
-rw-r--r--
wave.html
22.22
KB
-rw-r--r--
weakref.html
36.52
KB
-rw-r--r--
webbrowser.html
23.07
KB
-rw-r--r--
whichdb.html
8.85
KB
-rw-r--r--
windows.html
9.33
KB
-rw-r--r--
winsound.html
18.75
KB
-rw-r--r--
wsgiref.html
81.04
KB
-rw-r--r--
xdrlib.html
29.94
KB
-rw-r--r--
xml.dom.html
89.04
KB
-rw-r--r--
xml.dom.minidom.html
40.42
KB
-rw-r--r--
xml.dom.pulldom.html
12.71
KB
-rw-r--r--
xml.etree.elementtree.html
93.22
KB
-rw-r--r--
xml.html
16.49
KB
-rw-r--r--
xml.sax.handler.html
38.63
KB
-rw-r--r--
xml.sax.html
20.22
KB
-rw-r--r--
xml.sax.reader.html
39.09
KB
-rw-r--r--
xml.sax.utils.html
14.26
KB
-rw-r--r--
xmlrpclib.html
60.79
KB
-rw-r--r--
zipfile.html
53.14
KB
-rw-r--r--
zipimport.html
20.42
KB
-rw-r--r--
zlib.html
25.46
KB
-rw-r--r--
Delete
Unzip
Zip
${this.title}
Close
Code Editor : turtle.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>24.5. turtle — Turtle graphics for Tk — Python 2.7.5 documentation</title> <link rel="stylesheet" href="../_static/default.css" type="text/css" /> <link rel="stylesheet" href="../_static/pygments.css" type="text/css" /> <script type="text/javascript"> var DOCUMENTATION_OPTIONS = { URL_ROOT: '../', VERSION: '2.7.5', COLLAPSE_INDEX: false, FILE_SUFFIX: '.html', HAS_SOURCE: true }; </script> <script type="text/javascript" src="../_static/jquery.js"></script> <script type="text/javascript" src="../_static/underscore.js"></script> <script type="text/javascript" src="../_static/doctools.js"></script> <script type="text/javascript" src="../_static/sidebar.js"></script> <link rel="search" type="application/opensearchdescription+xml" title="Search within Python 2.7.5 documentation" href="../_static/opensearch.xml"/> <link rel="author" title="About these documents" href="../about.html" /> <link rel="copyright" title="Copyright" href="../copyright.html" /> <link rel="top" title="Python 2.7.5 documentation" href="../index.html" /> <link rel="up" title="24. Graphical User Interfaces with Tk" href="tk.html" /> <link rel="next" title="24.6. IDLE" href="idle.html" /> <link rel="prev" title="24.4. ScrolledText — Scrolled Text Widget" href="scrolledtext.html" /> <link rel="shortcut icon" type="image/png" href="../_static/py.png" /> <script type="text/javascript" src="../_static/copybutton.js"></script> </head> <body> <div class="related"> <h3>Navigation</h3> <ul> <li class="right" style="margin-right: 10px"> <a href="../genindex.html" title="General Index" accesskey="I">index</a></li> <li class="right" > <a href="../py-modindex.html" title="Python Module Index" >modules</a> |</li> <li class="right" > <a href="idle.html" title="24.6. IDLE" accesskey="N">next</a> |</li> <li class="right" > <a href="scrolledtext.html" title="24.4. ScrolledText — Scrolled Text Widget" accesskey="P">previous</a> |</li> <li><img src="../_static/py.png" alt="" style="vertical-align: middle; margin-top: -1px"/></li> <li><a href="http://www.python.org/">Python</a> »</li> <li> <a href="../index.html">Python 2.7.5 documentation</a> » </li> <li><a href="index.html" >The Python Standard Library</a> »</li> <li><a href="tk.html" accesskey="U">24. Graphical User Interfaces with Tk</a> »</li> </ul> </div> <div class="document"> <div class="documentwrapper"> <div class="bodywrapper"> <div class="body"> <div class="section" id="module-turtle"> <span id="turtle-turtle-graphics-for-tk"></span><h1>24.5. <a class="reference internal" href="#module-turtle" title="turtle: Turtle graphics for Tk"><tt class="xref py py-mod docutils literal"><span class="pre">turtle</span></tt></a> — Turtle graphics for Tk<a class="headerlink" href="#module-turtle" title="Permalink to this headline">¶</a></h1> <div class="section" id="introduction"> <h2>24.5.1. Introduction<a class="headerlink" href="#introduction" title="Permalink to this headline">¶</a></h2> <p>Turtle graphics is a popular way for introducing programming to kids. It was part of the original Logo programming language developed by Wally Feurzig and Seymour Papert in 1966.</p> <p>Imagine a robotic turtle starting at (0, 0) in the x-y plane. After an <tt class="docutils literal"><span class="pre">import</span> <span class="pre">turtle</span></tt>, give it the command <tt class="docutils literal"><span class="pre">turtle.forward(15)</span></tt>, and it moves (on-screen!) 15 pixels in the direction it is facing, drawing a line as it moves. Give it the command <tt class="docutils literal"><span class="pre">turtle.right(25)</span></tt>, and it rotates in-place 25 degrees clockwise.</p> <p>By combining together these and similar commands, intricate shapes and pictures can easily be drawn.</p> <p>The <a class="reference internal" href="#module-turtle" title="turtle: Turtle graphics for Tk"><tt class="xref py py-mod docutils literal"><span class="pre">turtle</span></tt></a> module is an extended reimplementation of the same-named module from the Python standard distribution up to version Python 2.5.</p> <p>It tries to keep the merits of the old turtle module and to be (nearly) 100% compatible with it. This means in the first place to enable the learning programmer to use all the commands, classes and methods interactively when using the module from within IDLE run with the <tt class="docutils literal"><span class="pre">-n</span></tt> switch.</p> <p>The turtle module provides turtle graphics primitives, in both object-oriented and procedure-oriented ways. Because it uses <a class="reference internal" href="tkinter.html#module-Tkinter" title="Tkinter: Interface to Tcl/Tk for graphical user interfaces"><tt class="xref py py-mod docutils literal"><span class="pre">Tkinter</span></tt></a> for the underlying graphics, it needs a version of Python installed with Tk support.</p> <p>The object-oriented interface uses essentially two+two classes:</p> <ol class="arabic"> <li><p class="first">The <a class="reference internal" href="#turtle.TurtleScreen" title="turtle.TurtleScreen"><tt class="xref py py-class docutils literal"><span class="pre">TurtleScreen</span></tt></a> class defines graphics windows as a playground for the drawing turtles. Its constructor needs a <tt class="xref py py-class docutils literal"><span class="pre">Tkinter.Canvas</span></tt> or a <a class="reference internal" href="#turtle.ScrolledCanvas" title="turtle.ScrolledCanvas"><tt class="xref py py-class docutils literal"><span class="pre">ScrolledCanvas</span></tt></a> as argument. It should be used when <a class="reference internal" href="#module-turtle" title="turtle: Turtle graphics for Tk"><tt class="xref py py-mod docutils literal"><span class="pre">turtle</span></tt></a> is used as part of some application.</p> <p>The function <a class="reference internal" href="#turtle.Screen" title="turtle.Screen"><tt class="xref py py-func docutils literal"><span class="pre">Screen()</span></tt></a> returns a singleton object of a <a class="reference internal" href="#turtle.TurtleScreen" title="turtle.TurtleScreen"><tt class="xref py py-class docutils literal"><span class="pre">TurtleScreen</span></tt></a> subclass. This function should be used when <a class="reference internal" href="#module-turtle" title="turtle: Turtle graphics for Tk"><tt class="xref py py-mod docutils literal"><span class="pre">turtle</span></tt></a> is used as a standalone tool for doing graphics. As a singleton object, inheriting from its class is not possible.</p> <p>All methods of TurtleScreen/Screen also exist as functions, i.e. as part of the procedure-oriented interface.</p> </li> <li><p class="first"><a class="reference internal" href="#turtle.RawTurtle" title="turtle.RawTurtle"><tt class="xref py py-class docutils literal"><span class="pre">RawTurtle</span></tt></a> (alias: <a class="reference internal" href="#turtle.RawPen" title="turtle.RawPen"><tt class="xref py py-class docutils literal"><span class="pre">RawPen</span></tt></a>) defines Turtle objects which draw on a <a class="reference internal" href="#turtle.TurtleScreen" title="turtle.TurtleScreen"><tt class="xref py py-class docutils literal"><span class="pre">TurtleScreen</span></tt></a>. Its constructor needs a Canvas, ScrolledCanvas or TurtleScreen as argument, so the RawTurtle objects know where to draw.</p> <p>Derived from RawTurtle is the subclass <a class="reference internal" href="#turtle.Turtle" title="turtle.Turtle"><tt class="xref py py-class docutils literal"><span class="pre">Turtle</span></tt></a> (alias: <tt class="xref py py-class docutils literal"><span class="pre">Pen</span></tt>), which draws on “the” <a class="reference internal" href="#turtle.Screen" title="turtle.Screen"><tt class="xref py py-class docutils literal"><span class="pre">Screen</span></tt></a> - instance which is automatically created, if not already present.</p> <p>All methods of RawTurtle/Turtle also exist as functions, i.e. part of the procedure-oriented interface.</p> </li> </ol> <p>The procedural interface provides functions which are derived from the methods of the classes <a class="reference internal" href="#turtle.Screen" title="turtle.Screen"><tt class="xref py py-class docutils literal"><span class="pre">Screen</span></tt></a> and <a class="reference internal" href="#turtle.Turtle" title="turtle.Turtle"><tt class="xref py py-class docutils literal"><span class="pre">Turtle</span></tt></a>. They have the same names as the corresponding methods. A screen object is automatically created whenever a function derived from a Screen method is called. An (unnamed) turtle object is automatically created whenever any of the functions derived from a Turtle method is called.</p> <p>To use multiple turtles an a screen one has to use the object-oriented interface.</p> <div class="admonition note"> <p class="first admonition-title">Note</p> <p class="last">In the following documentation the argument list for functions is given. Methods, of course, have the additional first argument <em>self</em> which is omitted here.</p> </div> </div> <div class="section" id="overview-over-available-turtle-and-screen-methods"> <h2>24.5.2. Overview over available Turtle and Screen methods<a class="headerlink" href="#overview-over-available-turtle-and-screen-methods" title="Permalink to this headline">¶</a></h2> <div class="section" id="turtle-methods"> <h3>24.5.2.1. Turtle methods<a class="headerlink" href="#turtle-methods" title="Permalink to this headline">¶</a></h3> <dl class="docutils"> <dt>Turtle motion</dt> <dd><dl class="first last docutils"> <dt>Move and draw</dt> <dd><div class="first last line-block"> <div class="line"><a class="reference internal" href="#turtle.forward" title="turtle.forward"><tt class="xref py py-func docutils literal"><span class="pre">forward()</span></tt></a> | <a class="reference internal" href="#turtle.fd" title="turtle.fd"><tt class="xref py py-func docutils literal"><span class="pre">fd()</span></tt></a></div> <div class="line"><a class="reference internal" href="#turtle.backward" title="turtle.backward"><tt class="xref py py-func docutils literal"><span class="pre">backward()</span></tt></a> | <a class="reference internal" href="#turtle.bk" title="turtle.bk"><tt class="xref py py-func docutils literal"><span class="pre">bk()</span></tt></a> | <a class="reference internal" href="#turtle.back" title="turtle.back"><tt class="xref py py-func docutils literal"><span class="pre">back()</span></tt></a></div> <div class="line"><a class="reference internal" href="#turtle.right" title="turtle.right"><tt class="xref py py-func docutils literal"><span class="pre">right()</span></tt></a> | <a class="reference internal" href="#turtle.rt" title="turtle.rt"><tt class="xref py py-func docutils literal"><span class="pre">rt()</span></tt></a></div> <div class="line"><a class="reference internal" href="#turtle.left" title="turtle.left"><tt class="xref py py-func docutils literal"><span class="pre">left()</span></tt></a> | <a class="reference internal" href="#turtle.lt" title="turtle.lt"><tt class="xref py py-func docutils literal"><span class="pre">lt()</span></tt></a></div> <div class="line"><a class="reference internal" href="#turtle.goto" title="turtle.goto"><tt class="xref py py-func docutils literal"><span class="pre">goto()</span></tt></a> | <a class="reference internal" href="#turtle.setpos" title="turtle.setpos"><tt class="xref py py-func docutils literal"><span class="pre">setpos()</span></tt></a> | <a class="reference internal" href="#turtle.setposition" title="turtle.setposition"><tt class="xref py py-func docutils literal"><span class="pre">setposition()</span></tt></a></div> <div class="line"><a class="reference internal" href="#turtle.setx" title="turtle.setx"><tt class="xref py py-func docutils literal"><span class="pre">setx()</span></tt></a></div> <div class="line"><a class="reference internal" href="#turtle.sety" title="turtle.sety"><tt class="xref py py-func docutils literal"><span class="pre">sety()</span></tt></a></div> <div class="line"><a class="reference internal" href="#turtle.setheading" title="turtle.setheading"><tt class="xref py py-func docutils literal"><span class="pre">setheading()</span></tt></a> | <a class="reference internal" href="#turtle.seth" title="turtle.seth"><tt class="xref py py-func docutils literal"><span class="pre">seth()</span></tt></a></div> <div class="line"><a class="reference internal" href="#turtle.home" title="turtle.home"><tt class="xref py py-func docutils literal"><span class="pre">home()</span></tt></a></div> <div class="line"><a class="reference internal" href="#turtle.circle" title="turtle.circle"><tt class="xref py py-func docutils literal"><span class="pre">circle()</span></tt></a></div> <div class="line"><a class="reference internal" href="#turtle.dot" title="turtle.dot"><tt class="xref py py-func docutils literal"><span class="pre">dot()</span></tt></a></div> <div class="line"><a class="reference internal" href="#turtle.stamp" title="turtle.stamp"><tt class="xref py py-func docutils literal"><span class="pre">stamp()</span></tt></a></div> <div class="line"><a class="reference internal" href="#turtle.clearstamp" title="turtle.clearstamp"><tt class="xref py py-func docutils literal"><span class="pre">clearstamp()</span></tt></a></div> <div class="line"><a class="reference internal" href="#turtle.clearstamps" title="turtle.clearstamps"><tt class="xref py py-func docutils literal"><span class="pre">clearstamps()</span></tt></a></div> <div class="line"><a class="reference internal" href="#turtle.undo" title="turtle.undo"><tt class="xref py py-func docutils literal"><span class="pre">undo()</span></tt></a></div> <div class="line"><a class="reference internal" href="#turtle.speed" title="turtle.speed"><tt class="xref py py-func docutils literal"><span class="pre">speed()</span></tt></a></div> </div> </dd> <dt>Tell Turtle’s state</dt> <dd><div class="first last line-block"> <div class="line"><a class="reference internal" href="#turtle.position" title="turtle.position"><tt class="xref py py-func docutils literal"><span class="pre">position()</span></tt></a> | <a class="reference internal" href="#turtle.pos" title="turtle.pos"><tt class="xref py py-func docutils literal"><span class="pre">pos()</span></tt></a></div> <div class="line"><a class="reference internal" href="#turtle.towards" title="turtle.towards"><tt class="xref py py-func docutils literal"><span class="pre">towards()</span></tt></a></div> <div class="line"><a class="reference internal" href="#turtle.xcor" title="turtle.xcor"><tt class="xref py py-func docutils literal"><span class="pre">xcor()</span></tt></a></div> <div class="line"><a class="reference internal" href="#turtle.ycor" title="turtle.ycor"><tt class="xref py py-func docutils literal"><span class="pre">ycor()</span></tt></a></div> <div class="line"><a class="reference internal" href="#turtle.heading" title="turtle.heading"><tt class="xref py py-func docutils literal"><span class="pre">heading()</span></tt></a></div> <div class="line"><a class="reference internal" href="#turtle.distance" title="turtle.distance"><tt class="xref py py-func docutils literal"><span class="pre">distance()</span></tt></a></div> </div> </dd> <dt>Setting and measurement</dt> <dd><div class="first last line-block"> <div class="line"><a class="reference internal" href="#turtle.degrees" title="turtle.degrees"><tt class="xref py py-func docutils literal"><span class="pre">degrees()</span></tt></a></div> <div class="line"><a class="reference internal" href="#turtle.radians" title="turtle.radians"><tt class="xref py py-func docutils literal"><span class="pre">radians()</span></tt></a></div> </div> </dd> </dl> </dd> <dt>Pen control</dt> <dd><dl class="first last docutils"> <dt>Drawing state</dt> <dd><div class="first last line-block"> <div class="line"><a class="reference internal" href="#turtle.pendown" title="turtle.pendown"><tt class="xref py py-func docutils literal"><span class="pre">pendown()</span></tt></a> | <a class="reference internal" href="#turtle.pd" title="turtle.pd"><tt class="xref py py-func docutils literal"><span class="pre">pd()</span></tt></a> | <a class="reference internal" href="#turtle.down" title="turtle.down"><tt class="xref py py-func docutils literal"><span class="pre">down()</span></tt></a></div> <div class="line"><a class="reference internal" href="#turtle.penup" title="turtle.penup"><tt class="xref py py-func docutils literal"><span class="pre">penup()</span></tt></a> | <a class="reference internal" href="#turtle.pu" title="turtle.pu"><tt class="xref py py-func docutils literal"><span class="pre">pu()</span></tt></a> | <a class="reference internal" href="#turtle.up" title="turtle.up"><tt class="xref py py-func docutils literal"><span class="pre">up()</span></tt></a></div> <div class="line"><a class="reference internal" href="#turtle.pensize" title="turtle.pensize"><tt class="xref py py-func docutils literal"><span class="pre">pensize()</span></tt></a> | <a class="reference internal" href="#turtle.width" title="turtle.width"><tt class="xref py py-func docutils literal"><span class="pre">width()</span></tt></a></div> <div class="line"><a class="reference internal" href="#turtle.pen" title="turtle.pen"><tt class="xref py py-func docutils literal"><span class="pre">pen()</span></tt></a></div> <div class="line"><a class="reference internal" href="#turtle.isdown" title="turtle.isdown"><tt class="xref py py-func docutils literal"><span class="pre">isdown()</span></tt></a></div> </div> </dd> <dt>Color control</dt> <dd><div class="first last line-block"> <div class="line"><a class="reference internal" href="#turtle.color" title="turtle.color"><tt class="xref py py-func docutils literal"><span class="pre">color()</span></tt></a></div> <div class="line"><a class="reference internal" href="#turtle.pencolor" title="turtle.pencolor"><tt class="xref py py-func docutils literal"><span class="pre">pencolor()</span></tt></a></div> <div class="line"><a class="reference internal" href="#turtle.fillcolor" title="turtle.fillcolor"><tt class="xref py py-func docutils literal"><span class="pre">fillcolor()</span></tt></a></div> </div> </dd> <dt>Filling</dt> <dd><div class="first last line-block"> <div class="line"><a class="reference internal" href="#turtle.fill" title="turtle.fill"><tt class="xref py py-func docutils literal"><span class="pre">fill()</span></tt></a></div> <div class="line"><a class="reference internal" href="#turtle.begin_fill" title="turtle.begin_fill"><tt class="xref py py-func docutils literal"><span class="pre">begin_fill()</span></tt></a></div> <div class="line"><a class="reference internal" href="#turtle.end_fill" title="turtle.end_fill"><tt class="xref py py-func docutils literal"><span class="pre">end_fill()</span></tt></a></div> </div> </dd> <dt>More drawing control</dt> <dd><div class="first last line-block"> <div class="line"><a class="reference internal" href="#turtle.reset" title="turtle.reset"><tt class="xref py py-func docutils literal"><span class="pre">reset()</span></tt></a></div> <div class="line"><a class="reference internal" href="#turtle.clear" title="turtle.clear"><tt class="xref py py-func docutils literal"><span class="pre">clear()</span></tt></a></div> <div class="line"><a class="reference internal" href="#turtle.write" title="turtle.write"><tt class="xref py py-func docutils literal"><span class="pre">write()</span></tt></a></div> </div> </dd> </dl> </dd> <dt>Turtle state</dt> <dd><dl class="first last docutils"> <dt>Visibility</dt> <dd><div class="first last line-block"> <div class="line"><a class="reference internal" href="#turtle.showturtle" title="turtle.showturtle"><tt class="xref py py-func docutils literal"><span class="pre">showturtle()</span></tt></a> | <a class="reference internal" href="#turtle.st" title="turtle.st"><tt class="xref py py-func docutils literal"><span class="pre">st()</span></tt></a></div> <div class="line"><a class="reference internal" href="#turtle.hideturtle" title="turtle.hideturtle"><tt class="xref py py-func docutils literal"><span class="pre">hideturtle()</span></tt></a> | <a class="reference internal" href="#turtle.ht" title="turtle.ht"><tt class="xref py py-func docutils literal"><span class="pre">ht()</span></tt></a></div> <div class="line"><a class="reference internal" href="#turtle.isvisible" title="turtle.isvisible"><tt class="xref py py-func docutils literal"><span class="pre">isvisible()</span></tt></a></div> </div> </dd> <dt>Appearance</dt> <dd><div class="first last line-block"> <div class="line"><a class="reference internal" href="#turtle.shape" title="turtle.shape"><tt class="xref py py-func docutils literal"><span class="pre">shape()</span></tt></a></div> <div class="line"><a class="reference internal" href="#turtle.resizemode" title="turtle.resizemode"><tt class="xref py py-func docutils literal"><span class="pre">resizemode()</span></tt></a></div> <div class="line"><a class="reference internal" href="#turtle.shapesize" title="turtle.shapesize"><tt class="xref py py-func docutils literal"><span class="pre">shapesize()</span></tt></a> | <a class="reference internal" href="#turtle.turtlesize" title="turtle.turtlesize"><tt class="xref py py-func docutils literal"><span class="pre">turtlesize()</span></tt></a></div> <div class="line"><a class="reference internal" href="#turtle.settiltangle" title="turtle.settiltangle"><tt class="xref py py-func docutils literal"><span class="pre">settiltangle()</span></tt></a></div> <div class="line"><a class="reference internal" href="#turtle.tiltangle" title="turtle.tiltangle"><tt class="xref py py-func docutils literal"><span class="pre">tiltangle()</span></tt></a></div> <div class="line"><a class="reference internal" href="#turtle.tilt" title="turtle.tilt"><tt class="xref py py-func docutils literal"><span class="pre">tilt()</span></tt></a></div> </div> </dd> </dl> </dd> <dt>Using events</dt> <dd><div class="first last line-block"> <div class="line"><a class="reference internal" href="#turtle.onclick" title="turtle.onclick"><tt class="xref py py-func docutils literal"><span class="pre">onclick()</span></tt></a></div> <div class="line"><a class="reference internal" href="#turtle.onrelease" title="turtle.onrelease"><tt class="xref py py-func docutils literal"><span class="pre">onrelease()</span></tt></a></div> <div class="line"><a class="reference internal" href="#turtle.ondrag" title="turtle.ondrag"><tt class="xref py py-func docutils literal"><span class="pre">ondrag()</span></tt></a></div> <div class="line"><a class="reference internal" href="#turtle.mainloop" title="turtle.mainloop"><tt class="xref py py-func docutils literal"><span class="pre">mainloop()</span></tt></a> | <a class="reference internal" href="#turtle.done" title="turtle.done"><tt class="xref py py-func docutils literal"><span class="pre">done()</span></tt></a></div> </div> </dd> <dt>Special Turtle methods</dt> <dd><div class="first last line-block"> <div class="line"><a class="reference internal" href="#turtle.begin_poly" title="turtle.begin_poly"><tt class="xref py py-func docutils literal"><span class="pre">begin_poly()</span></tt></a></div> <div class="line"><a class="reference internal" href="#turtle.end_poly" title="turtle.end_poly"><tt class="xref py py-func docutils literal"><span class="pre">end_poly()</span></tt></a></div> <div class="line"><a class="reference internal" href="#turtle.get_poly" title="turtle.get_poly"><tt class="xref py py-func docutils literal"><span class="pre">get_poly()</span></tt></a></div> <div class="line"><a class="reference internal" href="#turtle.clone" title="turtle.clone"><tt class="xref py py-func docutils literal"><span class="pre">clone()</span></tt></a></div> <div class="line"><a class="reference internal" href="#turtle.getturtle" title="turtle.getturtle"><tt class="xref py py-func docutils literal"><span class="pre">getturtle()</span></tt></a> | <a class="reference internal" href="#turtle.getpen" title="turtle.getpen"><tt class="xref py py-func docutils literal"><span class="pre">getpen()</span></tt></a></div> <div class="line"><a class="reference internal" href="#turtle.getscreen" title="turtle.getscreen"><tt class="xref py py-func docutils literal"><span class="pre">getscreen()</span></tt></a></div> <div class="line"><a class="reference internal" href="#turtle.setundobuffer" title="turtle.setundobuffer"><tt class="xref py py-func docutils literal"><span class="pre">setundobuffer()</span></tt></a></div> <div class="line"><a class="reference internal" href="#turtle.undobufferentries" title="turtle.undobufferentries"><tt class="xref py py-func docutils literal"><span class="pre">undobufferentries()</span></tt></a></div> <div class="line"><a class="reference internal" href="#turtle.tracer" title="turtle.tracer"><tt class="xref py py-func docutils literal"><span class="pre">tracer()</span></tt></a></div> <div class="line"><a class="reference internal" href="#turtle.window_width" title="turtle.window_width"><tt class="xref py py-func docutils literal"><span class="pre">window_width()</span></tt></a></div> <div class="line"><a class="reference internal" href="#turtle.window_height" title="turtle.window_height"><tt class="xref py py-func docutils literal"><span class="pre">window_height()</span></tt></a></div> </div> </dd> </dl> </div> <div class="section" id="methods-of-turtlescreen-screen"> <h3>24.5.2.2. Methods of TurtleScreen/Screen<a class="headerlink" href="#methods-of-turtlescreen-screen" title="Permalink to this headline">¶</a></h3> <dl class="docutils"> <dt>Window control</dt> <dd><div class="first last line-block"> <div class="line"><a class="reference internal" href="#turtle.bgcolor" title="turtle.bgcolor"><tt class="xref py py-func docutils literal"><span class="pre">bgcolor()</span></tt></a></div> <div class="line"><a class="reference internal" href="#turtle.bgpic" title="turtle.bgpic"><tt class="xref py py-func docutils literal"><span class="pre">bgpic()</span></tt></a></div> <div class="line"><a class="reference internal" href="#turtle.clear" title="turtle.clear"><tt class="xref py py-func docutils literal"><span class="pre">clear()</span></tt></a> | <a class="reference internal" href="#turtle.clearscreen" title="turtle.clearscreen"><tt class="xref py py-func docutils literal"><span class="pre">clearscreen()</span></tt></a></div> <div class="line"><a class="reference internal" href="#turtle.reset" title="turtle.reset"><tt class="xref py py-func docutils literal"><span class="pre">reset()</span></tt></a> | <a class="reference internal" href="#turtle.resetscreen" title="turtle.resetscreen"><tt class="xref py py-func docutils literal"><span class="pre">resetscreen()</span></tt></a></div> <div class="line"><a class="reference internal" href="#turtle.screensize" title="turtle.screensize"><tt class="xref py py-func docutils literal"><span class="pre">screensize()</span></tt></a></div> <div class="line"><a class="reference internal" href="#turtle.setworldcoordinates" title="turtle.setworldcoordinates"><tt class="xref py py-func docutils literal"><span class="pre">setworldcoordinates()</span></tt></a></div> </div> </dd> <dt>Animation control</dt> <dd><div class="first last line-block"> <div class="line"><a class="reference internal" href="#turtle.delay" title="turtle.delay"><tt class="xref py py-func docutils literal"><span class="pre">delay()</span></tt></a></div> <div class="line"><a class="reference internal" href="#turtle.tracer" title="turtle.tracer"><tt class="xref py py-func docutils literal"><span class="pre">tracer()</span></tt></a></div> <div class="line"><a class="reference internal" href="#turtle.update" title="turtle.update"><tt class="xref py py-func docutils literal"><span class="pre">update()</span></tt></a></div> </div> </dd> <dt>Using screen events</dt> <dd><div class="first last line-block"> <div class="line"><a class="reference internal" href="#turtle.listen" title="turtle.listen"><tt class="xref py py-func docutils literal"><span class="pre">listen()</span></tt></a></div> <div class="line"><a class="reference internal" href="#turtle.onkey" title="turtle.onkey"><tt class="xref py py-func docutils literal"><span class="pre">onkey()</span></tt></a></div> <div class="line"><a class="reference internal" href="#turtle.onclick" title="turtle.onclick"><tt class="xref py py-func docutils literal"><span class="pre">onclick()</span></tt></a> | <a class="reference internal" href="#turtle.onscreenclick" title="turtle.onscreenclick"><tt class="xref py py-func docutils literal"><span class="pre">onscreenclick()</span></tt></a></div> <div class="line"><a class="reference internal" href="#turtle.ontimer" title="turtle.ontimer"><tt class="xref py py-func docutils literal"><span class="pre">ontimer()</span></tt></a></div> </div> </dd> <dt>Settings and special methods</dt> <dd><div class="first last line-block"> <div class="line"><a class="reference internal" href="#turtle.mode" title="turtle.mode"><tt class="xref py py-func docutils literal"><span class="pre">mode()</span></tt></a></div> <div class="line"><a class="reference internal" href="#turtle.colormode" title="turtle.colormode"><tt class="xref py py-func docutils literal"><span class="pre">colormode()</span></tt></a></div> <div class="line"><a class="reference internal" href="#turtle.getcanvas" title="turtle.getcanvas"><tt class="xref py py-func docutils literal"><span class="pre">getcanvas()</span></tt></a></div> <div class="line"><a class="reference internal" href="#turtle.getshapes" title="turtle.getshapes"><tt class="xref py py-func docutils literal"><span class="pre">getshapes()</span></tt></a></div> <div class="line"><a class="reference internal" href="#turtle.register_shape" title="turtle.register_shape"><tt class="xref py py-func docutils literal"><span class="pre">register_shape()</span></tt></a> | <a class="reference internal" href="#turtle.addshape" title="turtle.addshape"><tt class="xref py py-func docutils literal"><span class="pre">addshape()</span></tt></a></div> <div class="line"><a class="reference internal" href="#turtle.turtles" title="turtle.turtles"><tt class="xref py py-func docutils literal"><span class="pre">turtles()</span></tt></a></div> <div class="line"><a class="reference internal" href="#turtle.window_height" title="turtle.window_height"><tt class="xref py py-func docutils literal"><span class="pre">window_height()</span></tt></a></div> <div class="line"><a class="reference internal" href="#turtle.window_width" title="turtle.window_width"><tt class="xref py py-func docutils literal"><span class="pre">window_width()</span></tt></a></div> </div> </dd> <dt>Methods specific to Screen</dt> <dd><div class="first last line-block"> <div class="line"><a class="reference internal" href="#turtle.bye" title="turtle.bye"><tt class="xref py py-func docutils literal"><span class="pre">bye()</span></tt></a></div> <div class="line"><a class="reference internal" href="#turtle.exitonclick" title="turtle.exitonclick"><tt class="xref py py-func docutils literal"><span class="pre">exitonclick()</span></tt></a></div> <div class="line"><a class="reference internal" href="#turtle.setup" title="turtle.setup"><tt class="xref py py-func docutils literal"><span class="pre">setup()</span></tt></a></div> <div class="line"><a class="reference internal" href="#turtle.title" title="turtle.title"><tt class="xref py py-func docutils literal"><span class="pre">title()</span></tt></a></div> </div> </dd> </dl> </div> </div> <div class="section" id="methods-of-rawturtle-turtle-and-corresponding-functions"> <h2>24.5.3. Methods of RawTurtle/Turtle and corresponding functions<a class="headerlink" href="#methods-of-rawturtle-turtle-and-corresponding-functions" title="Permalink to this headline">¶</a></h2> <p>Most of the examples in this section refer to a Turtle instance called <tt class="docutils literal"><span class="pre">turtle</span></tt>.</p> <div class="section" id="turtle-motion"> <h3>24.5.3.1. Turtle motion<a class="headerlink" href="#turtle-motion" title="Permalink to this headline">¶</a></h3> <dl class="function"> <dt id="turtle.forward"> <tt class="descclassname">turtle.</tt><tt class="descname">forward</tt><big>(</big><em>distance</em><big>)</big><a class="headerlink" href="#turtle.forward" title="Permalink to this definition">¶</a></dt> <dt id="turtle.fd"> <tt class="descclassname">turtle.</tt><tt class="descname">fd</tt><big>(</big><em>distance</em><big>)</big><a class="headerlink" href="#turtle.fd" title="Permalink to this definition">¶</a></dt> <dd><table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>distance</strong> – a number (integer or float)</td> </tr> </tbody> </table> <p>Move the turtle forward by the specified <em>distance</em>, in the direction the turtle is headed.</p> <div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">position</span><span class="p">()</span> <span class="go">(0.00,0.00)</span> <span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">forward</span><span class="p">(</span><span class="mi">25</span><span class="p">)</span> <span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">position</span><span class="p">()</span> <span class="go">(25.00,0.00)</span> <span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">forward</span><span class="p">(</span><span class="o">-</span><span class="mi">75</span><span class="p">)</span> <span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">position</span><span class="p">()</span> <span class="go">(-50.00,0.00)</span> </pre></div> </div> </dd></dl> <dl class="function"> <dt id="turtle.back"> <tt class="descclassname">turtle.</tt><tt class="descname">back</tt><big>(</big><em>distance</em><big>)</big><a class="headerlink" href="#turtle.back" title="Permalink to this definition">¶</a></dt> <dt id="turtle.bk"> <tt class="descclassname">turtle.</tt><tt class="descname">bk</tt><big>(</big><em>distance</em><big>)</big><a class="headerlink" href="#turtle.bk" title="Permalink to this definition">¶</a></dt> <dt id="turtle.backward"> <tt class="descclassname">turtle.</tt><tt class="descname">backward</tt><big>(</big><em>distance</em><big>)</big><a class="headerlink" href="#turtle.backward" title="Permalink to this definition">¶</a></dt> <dd><table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>distance</strong> – a number</td> </tr> </tbody> </table> <p>Move the turtle backward by <em>distance</em>, opposite to the direction the turtle is headed. Do not change the turtle’s heading.</p> <div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">position</span><span class="p">()</span> <span class="go">(0.00,0.00)</span> <span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">backward</span><span class="p">(</span><span class="mi">30</span><span class="p">)</span> <span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">position</span><span class="p">()</span> <span class="go">(-30.00,0.00)</span> </pre></div> </div> </dd></dl> <dl class="function"> <dt id="turtle.right"> <tt class="descclassname">turtle.</tt><tt class="descname">right</tt><big>(</big><em>angle</em><big>)</big><a class="headerlink" href="#turtle.right" title="Permalink to this definition">¶</a></dt> <dt id="turtle.rt"> <tt class="descclassname">turtle.</tt><tt class="descname">rt</tt><big>(</big><em>angle</em><big>)</big><a class="headerlink" href="#turtle.rt" title="Permalink to this definition">¶</a></dt> <dd><table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>angle</strong> – a number (integer or float)</td> </tr> </tbody> </table> <p>Turn turtle right by <em>angle</em> units. (Units are by default degrees, but can be set via the <a class="reference internal" href="#turtle.degrees" title="turtle.degrees"><tt class="xref py py-func docutils literal"><span class="pre">degrees()</span></tt></a> and <a class="reference internal" href="#turtle.radians" title="turtle.radians"><tt class="xref py py-func docutils literal"><span class="pre">radians()</span></tt></a> functions.) Angle orientation depends on the turtle mode, see <a class="reference internal" href="#turtle.mode" title="turtle.mode"><tt class="xref py py-func docutils literal"><span class="pre">mode()</span></tt></a>.</p> <div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">heading</span><span class="p">()</span> <span class="go">22.0</span> <span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">right</span><span class="p">(</span><span class="mi">45</span><span class="p">)</span> <span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">heading</span><span class="p">()</span> <span class="go">337.0</span> </pre></div> </div> </dd></dl> <dl class="function"> <dt id="turtle.left"> <tt class="descclassname">turtle.</tt><tt class="descname">left</tt><big>(</big><em>angle</em><big>)</big><a class="headerlink" href="#turtle.left" title="Permalink to this definition">¶</a></dt> <dt id="turtle.lt"> <tt class="descclassname">turtle.</tt><tt class="descname">lt</tt><big>(</big><em>angle</em><big>)</big><a class="headerlink" href="#turtle.lt" title="Permalink to this definition">¶</a></dt> <dd><table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>angle</strong> – a number (integer or float)</td> </tr> </tbody> </table> <p>Turn turtle left by <em>angle</em> units. (Units are by default degrees, but can be set via the <a class="reference internal" href="#turtle.degrees" title="turtle.degrees"><tt class="xref py py-func docutils literal"><span class="pre">degrees()</span></tt></a> and <a class="reference internal" href="#turtle.radians" title="turtle.radians"><tt class="xref py py-func docutils literal"><span class="pre">radians()</span></tt></a> functions.) Angle orientation depends on the turtle mode, see <a class="reference internal" href="#turtle.mode" title="turtle.mode"><tt class="xref py py-func docutils literal"><span class="pre">mode()</span></tt></a>.</p> <div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">heading</span><span class="p">()</span> <span class="go">22.0</span> <span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">left</span><span class="p">(</span><span class="mi">45</span><span class="p">)</span> <span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">heading</span><span class="p">()</span> <span class="go">67.0</span> </pre></div> </div> </dd></dl> <dl class="function"> <dt id="turtle.goto"> <tt class="descclassname">turtle.</tt><tt class="descname">goto</tt><big>(</big><em>x</em>, <em>y=None</em><big>)</big><a class="headerlink" href="#turtle.goto" title="Permalink to this definition">¶</a></dt> <dt id="turtle.setpos"> <tt class="descclassname">turtle.</tt><tt class="descname">setpos</tt><big>(</big><em>x</em>, <em>y=None</em><big>)</big><a class="headerlink" href="#turtle.setpos" title="Permalink to this definition">¶</a></dt> <dt id="turtle.setposition"> <tt class="descclassname">turtle.</tt><tt class="descname">setposition</tt><big>(</big><em>x</em>, <em>y=None</em><big>)</big><a class="headerlink" href="#turtle.setposition" title="Permalink to this definition">¶</a></dt> <dd><table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple"> <li><strong>x</strong> – a number or a pair/vector of numbers</li> <li><strong>y</strong> – a number or <tt class="docutils literal"><span class="pre">None</span></tt></li> </ul> </td> </tr> </tbody> </table> <p>If <em>y</em> is <tt class="docutils literal"><span class="pre">None</span></tt>, <em>x</em> must be a pair of coordinates or a <a class="reference internal" href="#turtle.Vec2D" title="turtle.Vec2D"><tt class="xref py py-class docutils literal"><span class="pre">Vec2D</span></tt></a> (e.g. as returned by <a class="reference internal" href="#turtle.pos" title="turtle.pos"><tt class="xref py py-func docutils literal"><span class="pre">pos()</span></tt></a>).</p> <p>Move turtle to an absolute position. If the pen is down, draw line. Do not change the turtle’s orientation.</p> <div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="n">tp</span> <span class="o">=</span> <span class="n">turtle</span><span class="o">.</span><span class="n">pos</span><span class="p">()</span> <span class="gp">>>> </span><span class="n">tp</span> <span class="go">(0.00,0.00)</span> <span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">setpos</span><span class="p">(</span><span class="mi">60</span><span class="p">,</span><span class="mi">30</span><span class="p">)</span> <span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">pos</span><span class="p">()</span> <span class="go">(60.00,30.00)</span> <span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">setpos</span><span class="p">((</span><span class="mi">20</span><span class="p">,</span><span class="mi">80</span><span class="p">))</span> <span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">pos</span><span class="p">()</span> <span class="go">(20.00,80.00)</span> <span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">setpos</span><span class="p">(</span><span class="n">tp</span><span class="p">)</span> <span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">pos</span><span class="p">()</span> <span class="go">(0.00,0.00)</span> </pre></div> </div> </dd></dl> <dl class="function"> <dt id="turtle.setx"> <tt class="descclassname">turtle.</tt><tt class="descname">setx</tt><big>(</big><em>x</em><big>)</big><a class="headerlink" href="#turtle.setx" title="Permalink to this definition">¶</a></dt> <dd><table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>x</strong> – a number (integer or float)</td> </tr> </tbody> </table> <p>Set the turtle’s first coordinate to <em>x</em>, leave second coordinate unchanged.</p> <div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">position</span><span class="p">()</span> <span class="go">(0.00,240.00)</span> <span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">setx</span><span class="p">(</span><span class="mi">10</span><span class="p">)</span> <span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">position</span><span class="p">()</span> <span class="go">(10.00,240.00)</span> </pre></div> </div> </dd></dl> <dl class="function"> <dt id="turtle.sety"> <tt class="descclassname">turtle.</tt><tt class="descname">sety</tt><big>(</big><em>y</em><big>)</big><a class="headerlink" href="#turtle.sety" title="Permalink to this definition">¶</a></dt> <dd><table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>y</strong> – a number (integer or float)</td> </tr> </tbody> </table> <p>Set the turtle’s second coordinate to <em>y</em>, leave first coordinate unchanged.</p> <div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">position</span><span class="p">()</span> <span class="go">(0.00,40.00)</span> <span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">sety</span><span class="p">(</span><span class="o">-</span><span class="mi">10</span><span class="p">)</span> <span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">position</span><span class="p">()</span> <span class="go">(0.00,-10.00)</span> </pre></div> </div> </dd></dl> <dl class="function"> <dt id="turtle.setheading"> <tt class="descclassname">turtle.</tt><tt class="descname">setheading</tt><big>(</big><em>to_angle</em><big>)</big><a class="headerlink" href="#turtle.setheading" title="Permalink to this definition">¶</a></dt> <dt id="turtle.seth"> <tt class="descclassname">turtle.</tt><tt class="descname">seth</tt><big>(</big><em>to_angle</em><big>)</big><a class="headerlink" href="#turtle.seth" title="Permalink to this definition">¶</a></dt> <dd><table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>to_angle</strong> – a number (integer or float)</td> </tr> </tbody> </table> <p>Set the orientation of the turtle to <em>to_angle</em>. Here are some common directions in degrees:</p> <table border="1" class="docutils"> <colgroup> <col width="49%" /> <col width="51%" /> </colgroup> <thead valign="bottom"> <tr class="row-odd"><th class="head">standard mode</th> <th class="head">logo mode</th> </tr> </thead> <tbody valign="top"> <tr class="row-even"><td>0 - east</td> <td>0 - north</td> </tr> <tr class="row-odd"><td>90 - north</td> <td>90 - east</td> </tr> <tr class="row-even"><td>180 - west</td> <td>180 - south</td> </tr> <tr class="row-odd"><td>270 - south</td> <td>270 - west</td> </tr> </tbody> </table> <div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">setheading</span><span class="p">(</span><span class="mi">90</span><span class="p">)</span> <span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">heading</span><span class="p">()</span> <span class="go">90.0</span> </pre></div> </div> </dd></dl> <dl class="function"> <dt id="turtle.home"> <tt class="descclassname">turtle.</tt><tt class="descname">home</tt><big>(</big><big>)</big><a class="headerlink" href="#turtle.home" title="Permalink to this definition">¶</a></dt> <dd><p>Move turtle to the origin – coordinates (0,0) – and set its heading to its start-orientation (which depends on the mode, see <a class="reference internal" href="#turtle.mode" title="turtle.mode"><tt class="xref py py-func docutils literal"><span class="pre">mode()</span></tt></a>).</p> <div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">heading</span><span class="p">()</span> <span class="go">90.0</span> <span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">position</span><span class="p">()</span> <span class="go">(0.00,-10.00)</span> <span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">home</span><span class="p">()</span> <span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">position</span><span class="p">()</span> <span class="go">(0.00,0.00)</span> <span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">heading</span><span class="p">()</span> <span class="go">0.0</span> </pre></div> </div> </dd></dl> <dl class="function"> <dt id="turtle.circle"> <tt class="descclassname">turtle.</tt><tt class="descname">circle</tt><big>(</big><em>radius</em>, <em>extent=None</em>, <em>steps=None</em><big>)</big><a class="headerlink" href="#turtle.circle" title="Permalink to this definition">¶</a></dt> <dd><table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple"> <li><strong>radius</strong> – a number</li> <li><strong>extent</strong> – a number (or <tt class="docutils literal"><span class="pre">None</span></tt>)</li> <li><strong>steps</strong> – an integer (or <tt class="docutils literal"><span class="pre">None</span></tt>)</li> </ul> </td> </tr> </tbody> </table> <p>Draw a circle with given <em>radius</em>. The center is <em>radius</em> units left of the turtle; <em>extent</em> – an angle – determines which part of the circle is drawn. If <em>extent</em> is not given, draw the entire circle. If <em>extent</em> is not a full circle, one endpoint of the arc is the current pen position. Draw the arc in counterclockwise direction if <em>radius</em> is positive, otherwise in clockwise direction. Finally the direction of the turtle is changed by the amount of <em>extent</em>.</p> <p>As the circle is approximated by an inscribed regular polygon, <em>steps</em> determines the number of steps to use. If not given, it will be calculated automatically. May be used to draw regular polygons.</p> <div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">home</span><span class="p">()</span> <span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">position</span><span class="p">()</span> <span class="go">(0.00,0.00)</span> <span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">heading</span><span class="p">()</span> <span class="go">0.0</span> <span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">circle</span><span class="p">(</span><span class="mi">50</span><span class="p">)</span> <span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">position</span><span class="p">()</span> <span class="go">(-0.00,0.00)</span> <span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">heading</span><span class="p">()</span> <span class="go">0.0</span> <span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">circle</span><span class="p">(</span><span class="mi">120</span><span class="p">,</span> <span class="mi">180</span><span class="p">)</span> <span class="c"># draw a semicircle</span> <span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">position</span><span class="p">()</span> <span class="go">(0.00,240.00)</span> <span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">heading</span><span class="p">()</span> <span class="go">180.0</span> </pre></div> </div> </dd></dl> <dl class="function"> <dt id="turtle.dot"> <tt class="descclassname">turtle.</tt><tt class="descname">dot</tt><big>(</big><em>size=None</em>, <em>*color</em><big>)</big><a class="headerlink" href="#turtle.dot" title="Permalink to this definition">¶</a></dt> <dd><table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple"> <li><strong>size</strong> – an integer >= 1 (if given)</li> <li><strong>color</strong> – a colorstring or a numeric color tuple</li> </ul> </td> </tr> </tbody> </table> <p>Draw a circular dot with diameter <em>size</em>, using <em>color</em>. If <em>size</em> is not given, the maximum of pensize+4 and 2*pensize is used.</p> <div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">home</span><span class="p">()</span> <span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">dot</span><span class="p">()</span> <span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">fd</span><span class="p">(</span><span class="mi">50</span><span class="p">);</span> <span class="n">turtle</span><span class="o">.</span><span class="n">dot</span><span class="p">(</span><span class="mi">20</span><span class="p">,</span> <span class="s">"blue"</span><span class="p">);</span> <span class="n">turtle</span><span class="o">.</span><span class="n">fd</span><span class="p">(</span><span class="mi">50</span><span class="p">)</span> <span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">position</span><span class="p">()</span> <span class="go">(100.00,-0.00)</span> <span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">heading</span><span class="p">()</span> <span class="go">0.0</span> </pre></div> </div> </dd></dl> <dl class="function"> <dt id="turtle.stamp"> <tt class="descclassname">turtle.</tt><tt class="descname">stamp</tt><big>(</big><big>)</big><a class="headerlink" href="#turtle.stamp" title="Permalink to this definition">¶</a></dt> <dd><p>Stamp a copy of the turtle shape onto the canvas at the current turtle position. Return a stamp_id for that stamp, which can be used to delete it by calling <tt class="docutils literal"><span class="pre">clearstamp(stamp_id)</span></tt>.</p> <div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">color</span><span class="p">(</span><span class="s">"blue"</span><span class="p">)</span> <span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">stamp</span><span class="p">()</span> <span class="go">11</span> <span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">fd</span><span class="p">(</span><span class="mi">50</span><span class="p">)</span> </pre></div> </div> </dd></dl> <dl class="function"> <dt id="turtle.clearstamp"> <tt class="descclassname">turtle.</tt><tt class="descname">clearstamp</tt><big>(</big><em>stampid</em><big>)</big><a class="headerlink" href="#turtle.clearstamp" title="Permalink to this definition">¶</a></dt> <dd><table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>stampid</strong> – an integer, must be return value of previous <a class="reference internal" href="#turtle.stamp" title="turtle.stamp"><tt class="xref py py-func docutils literal"><span class="pre">stamp()</span></tt></a> call</td> </tr> </tbody> </table> <p>Delete stamp with given <em>stampid</em>.</p> <div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">position</span><span class="p">()</span> <span class="go">(150.00,-0.00)</span> <span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">color</span><span class="p">(</span><span class="s">"blue"</span><span class="p">)</span> <span class="gp">>>> </span><span class="n">astamp</span> <span class="o">=</span> <span class="n">turtle</span><span class="o">.</span><span class="n">stamp</span><span class="p">()</span> <span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">fd</span><span class="p">(</span><span class="mi">50</span><span class="p">)</span> <span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">position</span><span class="p">()</span> <span class="go">(200.00,-0.00)</span> <span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">clearstamp</span><span class="p">(</span><span class="n">astamp</span><span class="p">)</span> <span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">position</span><span class="p">()</span> <span class="go">(200.00,-0.00)</span> </pre></div> </div> </dd></dl> <dl class="function"> <dt id="turtle.clearstamps"> <tt class="descclassname">turtle.</tt><tt class="descname">clearstamps</tt><big>(</big><em>n=None</em><big>)</big><a class="headerlink" href="#turtle.clearstamps" title="Permalink to this definition">¶</a></dt> <dd><table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>n</strong> – an integer (or <tt class="docutils literal"><span class="pre">None</span></tt>)</td> </tr> </tbody> </table> <p>Delete all or first/last <em>n</em> of turtle’s stamps. If <em>n</em> is None, delete all stamps, if <em>n</em> > 0 delete first <em>n</em> stamps, else if <em>n</em> < 0 delete last <em>n</em> stamps.</p> <div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="mi">8</span><span class="p">):</span> <span class="gp">... </span> <span class="n">turtle</span><span class="o">.</span><span class="n">stamp</span><span class="p">();</span> <span class="n">turtle</span><span class="o">.</span><span class="n">fd</span><span class="p">(</span><span class="mi">30</span><span class="p">)</span> <span class="go">13</span> <span class="go">14</span> <span class="go">15</span> <span class="go">16</span> <span class="go">17</span> <span class="go">18</span> <span class="go">19</span> <span class="go">20</span> <span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">clearstamps</span><span class="p">(</span><span class="mi">2</span><span class="p">)</span> <span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">clearstamps</span><span class="p">(</span><span class="o">-</span><span class="mi">2</span><span class="p">)</span> <span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">clearstamps</span><span class="p">()</span> </pre></div> </div> </dd></dl> <dl class="function"> <dt id="turtle.undo"> <tt class="descclassname">turtle.</tt><tt class="descname">undo</tt><big>(</big><big>)</big><a class="headerlink" href="#turtle.undo" title="Permalink to this definition">¶</a></dt> <dd><p>Undo (repeatedly) the last turtle action(s). Number of available undo actions is determined by the size of the undobuffer.</p> <div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="mi">4</span><span class="p">):</span> <span class="gp">... </span> <span class="n">turtle</span><span class="o">.</span><span class="n">fd</span><span class="p">(</span><span class="mi">50</span><span class="p">);</span> <span class="n">turtle</span><span class="o">.</span><span class="n">lt</span><span class="p">(</span><span class="mi">80</span><span class="p">)</span> <span class="gp">...</span> <span class="gp">>>> </span><span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="mi">8</span><span class="p">):</span> <span class="gp">... </span> <span class="n">turtle</span><span class="o">.</span><span class="n">undo</span><span class="p">()</span> </pre></div> </div> </dd></dl> <dl class="function"> <dt id="turtle.speed"> <tt class="descclassname">turtle.</tt><tt class="descname">speed</tt><big>(</big><em>speed=None</em><big>)</big><a class="headerlink" href="#turtle.speed" title="Permalink to this definition">¶</a></dt> <dd><table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>speed</strong> – an integer in the range 0..10 or a speedstring (see below)</td> </tr> </tbody> </table> <p>Set the turtle’s speed to an integer value in the range 0..10. If no argument is given, return current speed.</p> <p>If input is a number greater than 10 or smaller than 0.5, speed is set to 0. Speedstrings are mapped to speedvalues as follows:</p> <ul class="simple"> <li>“fastest”: 0</li> <li>“fast”: 10</li> <li>“normal”: 6</li> <li>“slow”: 3</li> <li>“slowest”: 1</li> </ul> <p>Speeds from 1 to 10 enforce increasingly faster animation of line drawing and turtle turning.</p> <p>Attention: <em>speed</em> = 0 means that <em>no</em> animation takes place. forward/back makes turtle jump and likewise left/right make the turtle turn instantly.</p> <div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">speed</span><span class="p">()</span> <span class="go">3</span> <span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">speed</span><span class="p">(</span><span class="s">'normal'</span><span class="p">)</span> <span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">speed</span><span class="p">()</span> <span class="go">6</span> <span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">speed</span><span class="p">(</span><span class="mi">9</span><span class="p">)</span> <span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">speed</span><span class="p">()</span> <span class="go">9</span> </pre></div> </div> </dd></dl> </div> <div class="section" id="tell-turtle-s-state"> <h3>24.5.3.2. Tell Turtle’s state<a class="headerlink" href="#tell-turtle-s-state" title="Permalink to this headline">¶</a></h3> <dl class="function"> <dt id="turtle.position"> <tt class="descclassname">turtle.</tt><tt class="descname">position</tt><big>(</big><big>)</big><a class="headerlink" href="#turtle.position" title="Permalink to this definition">¶</a></dt> <dt id="turtle.pos"> <tt class="descclassname">turtle.</tt><tt class="descname">pos</tt><big>(</big><big>)</big><a class="headerlink" href="#turtle.pos" title="Permalink to this definition">¶</a></dt> <dd><p>Return the turtle’s current location (x,y) (as a <a class="reference internal" href="#turtle.Vec2D" title="turtle.Vec2D"><tt class="xref py py-class docutils literal"><span class="pre">Vec2D</span></tt></a> vector).</p> <div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">pos</span><span class="p">()</span> <span class="go">(440.00,-0.00)</span> </pre></div> </div> </dd></dl> <dl class="function"> <dt id="turtle.towards"> <tt class="descclassname">turtle.</tt><tt class="descname">towards</tt><big>(</big><em>x</em>, <em>y=None</em><big>)</big><a class="headerlink" href="#turtle.towards" title="Permalink to this definition">¶</a></dt> <dd><table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple"> <li><strong>x</strong> – a number or a pair/vector of numbers or a turtle instance</li> <li><strong>y</strong> – a number if <em>x</em> is a number, else <tt class="docutils literal"><span class="pre">None</span></tt></li> </ul> </td> </tr> </tbody> </table> <p>Return the angle between the line from turtle position to position specified by (x,y), the vector or the other turtle. This depends on the turtle’s start orientation which depends on the mode - “standard”/”world” or “logo”).</p> <div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">goto</span><span class="p">(</span><span class="mi">10</span><span class="p">,</span> <span class="mi">10</span><span class="p">)</span> <span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">towards</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span><span class="mi">0</span><span class="p">)</span> <span class="go">225.0</span> </pre></div> </div> </dd></dl> <dl class="function"> <dt id="turtle.xcor"> <tt class="descclassname">turtle.</tt><tt class="descname">xcor</tt><big>(</big><big>)</big><a class="headerlink" href="#turtle.xcor" title="Permalink to this definition">¶</a></dt> <dd><p>Return the turtle’s x coordinate.</p> <div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">home</span><span class="p">()</span> <span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">left</span><span class="p">(</span><span class="mi">50</span><span class="p">)</span> <span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">forward</span><span class="p">(</span><span class="mi">100</span><span class="p">)</span> <span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">pos</span><span class="p">()</span> <span class="go">(64.28,76.60)</span> <span class="gp">>>> </span><span class="k">print</span> <span class="n">turtle</span><span class="o">.</span><span class="n">xcor</span><span class="p">()</span> <span class="go">64.2787609687</span> </pre></div> </div> </dd></dl> <dl class="function"> <dt id="turtle.ycor"> <tt class="descclassname">turtle.</tt><tt class="descname">ycor</tt><big>(</big><big>)</big><a class="headerlink" href="#turtle.ycor" title="Permalink to this definition">¶</a></dt> <dd><p>Return the turtle’s y coordinate.</p> <div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">home</span><span class="p">()</span> <span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">left</span><span class="p">(</span><span class="mi">60</span><span class="p">)</span> <span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">forward</span><span class="p">(</span><span class="mi">100</span><span class="p">)</span> <span class="gp">>>> </span><span class="k">print</span> <span class="n">turtle</span><span class="o">.</span><span class="n">pos</span><span class="p">()</span> <span class="go">(50.00,86.60)</span> <span class="gp">>>> </span><span class="k">print</span> <span class="n">turtle</span><span class="o">.</span><span class="n">ycor</span><span class="p">()</span> <span class="go">86.6025403784</span> </pre></div> </div> </dd></dl> <dl class="function"> <dt id="turtle.heading"> <tt class="descclassname">turtle.</tt><tt class="descname">heading</tt><big>(</big><big>)</big><a class="headerlink" href="#turtle.heading" title="Permalink to this definition">¶</a></dt> <dd><p>Return the turtle’s current heading (value depends on the turtle mode, see <a class="reference internal" href="#turtle.mode" title="turtle.mode"><tt class="xref py py-func docutils literal"><span class="pre">mode()</span></tt></a>).</p> <div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">home</span><span class="p">()</span> <span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">left</span><span class="p">(</span><span class="mi">67</span><span class="p">)</span> <span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">heading</span><span class="p">()</span> <span class="go">67.0</span> </pre></div> </div> </dd></dl> <dl class="function"> <dt id="turtle.distance"> <tt class="descclassname">turtle.</tt><tt class="descname">distance</tt><big>(</big><em>x</em>, <em>y=None</em><big>)</big><a class="headerlink" href="#turtle.distance" title="Permalink to this definition">¶</a></dt> <dd><table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple"> <li><strong>x</strong> – a number or a pair/vector of numbers or a turtle instance</li> <li><strong>y</strong> – a number if <em>x</em> is a number, else <tt class="docutils literal"><span class="pre">None</span></tt></li> </ul> </td> </tr> </tbody> </table> <p>Return the distance from the turtle to (x,y), the given vector, or the given other turtle, in turtle step units.</p> <div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">home</span><span class="p">()</span> <span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">distance</span><span class="p">(</span><span class="mi">30</span><span class="p">,</span><span class="mi">40</span><span class="p">)</span> <span class="go">50.0</span> <span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">distance</span><span class="p">((</span><span class="mi">30</span><span class="p">,</span><span class="mi">40</span><span class="p">))</span> <span class="go">50.0</span> <span class="gp">>>> </span><span class="n">joe</span> <span class="o">=</span> <span class="n">Turtle</span><span class="p">()</span> <span class="gp">>>> </span><span class="n">joe</span><span class="o">.</span><span class="n">forward</span><span class="p">(</span><span class="mi">77</span><span class="p">)</span> <span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">distance</span><span class="p">(</span><span class="n">joe</span><span class="p">)</span> <span class="go">77.0</span> </pre></div> </div> </dd></dl> </div> <div class="section" id="settings-for-measurement"> <h3>24.5.3.3. Settings for measurement<a class="headerlink" href="#settings-for-measurement" title="Permalink to this headline">¶</a></h3> <dl class="function"> <dt id="turtle.degrees"> <tt class="descclassname">turtle.</tt><tt class="descname">degrees</tt><big>(</big><em>fullcircle=360.0</em><big>)</big><a class="headerlink" href="#turtle.degrees" title="Permalink to this definition">¶</a></dt> <dd><table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>fullcircle</strong> – a number</td> </tr> </tbody> </table> <p>Set angle measurement units, i.e. set number of “degrees” for a full circle. Default value is 360 degrees.</p> <div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">home</span><span class="p">()</span> <span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">left</span><span class="p">(</span><span class="mi">90</span><span class="p">)</span> <span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">heading</span><span class="p">()</span> <span class="go">90.0</span> <span class="go">Change angle measurement unit to grad (also known as gon,</span> <span class="go">grade, or gradian and equals 1/100-th of the right angle.)</span> <span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">degrees</span><span class="p">(</span><span class="mf">400.0</span><span class="p">)</span> <span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">heading</span><span class="p">()</span> <span class="go">100.0</span> <span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">degrees</span><span class="p">(</span><span class="mi">360</span><span class="p">)</span> <span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">heading</span><span class="p">()</span> <span class="go">90.0</span> </pre></div> </div> </dd></dl> <dl class="function"> <dt id="turtle.radians"> <tt class="descclassname">turtle.</tt><tt class="descname">radians</tt><big>(</big><big>)</big><a class="headerlink" href="#turtle.radians" title="Permalink to this definition">¶</a></dt> <dd><p>Set the angle measurement units to radians. Equivalent to <tt class="docutils literal"><span class="pre">degrees(2*math.pi)</span></tt>.</p> <div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">home</span><span class="p">()</span> <span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">left</span><span class="p">(</span><span class="mi">90</span><span class="p">)</span> <span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">heading</span><span class="p">()</span> <span class="go">90.0</span> <span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">radians</span><span class="p">()</span> <span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">heading</span><span class="p">()</span> <span class="go">1.5707963267948966</span> </pre></div> </div> </dd></dl> </div> <div class="section" id="pen-control"> <h3>24.5.3.4. Pen control<a class="headerlink" href="#pen-control" title="Permalink to this headline">¶</a></h3> <div class="section" id="drawing-state"> <h4>24.5.3.4.1. Drawing state<a class="headerlink" href="#drawing-state" title="Permalink to this headline">¶</a></h4> <dl class="function"> <dt id="turtle.pendown"> <tt class="descclassname">turtle.</tt><tt class="descname">pendown</tt><big>(</big><big>)</big><a class="headerlink" href="#turtle.pendown" title="Permalink to this definition">¶</a></dt> <dt id="turtle.pd"> <tt class="descclassname">turtle.</tt><tt class="descname">pd</tt><big>(</big><big>)</big><a class="headerlink" href="#turtle.pd" title="Permalink to this definition">¶</a></dt> <dt id="turtle.down"> <tt class="descclassname">turtle.</tt><tt class="descname">down</tt><big>(</big><big>)</big><a class="headerlink" href="#turtle.down" title="Permalink to this definition">¶</a></dt> <dd><p>Pull the pen down – drawing when moving.</p> </dd></dl> <dl class="function"> <dt id="turtle.penup"> <tt class="descclassname">turtle.</tt><tt class="descname">penup</tt><big>(</big><big>)</big><a class="headerlink" href="#turtle.penup" title="Permalink to this definition">¶</a></dt> <dt id="turtle.pu"> <tt class="descclassname">turtle.</tt><tt class="descname">pu</tt><big>(</big><big>)</big><a class="headerlink" href="#turtle.pu" title="Permalink to this definition">¶</a></dt> <dt id="turtle.up"> <tt class="descclassname">turtle.</tt><tt class="descname">up</tt><big>(</big><big>)</big><a class="headerlink" href="#turtle.up" title="Permalink to this definition">¶</a></dt> <dd><p>Pull the pen up – no drawing when moving.</p> </dd></dl> <dl class="function"> <dt id="turtle.pensize"> <tt class="descclassname">turtle.</tt><tt class="descname">pensize</tt><big>(</big><em>width=None</em><big>)</big><a class="headerlink" href="#turtle.pensize" title="Permalink to this definition">¶</a></dt> <dt id="turtle.width"> <tt class="descclassname">turtle.</tt><tt class="descname">width</tt><big>(</big><em>width=None</em><big>)</big><a class="headerlink" href="#turtle.width" title="Permalink to this definition">¶</a></dt> <dd><table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>width</strong> – a positive number</td> </tr> </tbody> </table> <p>Set the line thickness to <em>width</em> or return it. If resizemode is set to “auto” and turtleshape is a polygon, that polygon is drawn with the same line thickness. If no argument is given, the current pensize is returned.</p> <div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">pensize</span><span class="p">()</span> <span class="go">1</span> <span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">pensize</span><span class="p">(</span><span class="mi">10</span><span class="p">)</span> <span class="c"># from here on lines of width 10 are drawn</span> </pre></div> </div> </dd></dl> <dl class="function"> <dt id="turtle.pen"> <tt class="descclassname">turtle.</tt><tt class="descname">pen</tt><big>(</big><em>pen=None</em>, <em>**pendict</em><big>)</big><a class="headerlink" href="#turtle.pen" title="Permalink to this definition">¶</a></dt> <dd><table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple"> <li><strong>pen</strong> – a dictionary with some or all of the below listed keys</li> <li><strong>pendict</strong> – one or more keyword-arguments with the below listed keys as keywords</li> </ul> </td> </tr> </tbody> </table> <p>Return or set the pen’s attributes in a “pen-dictionary” with the following key/value pairs:</p> <ul class="simple"> <li>“shown”: True/False</li> <li>“pendown”: True/False</li> <li>“pencolor”: color-string or color-tuple</li> <li>“fillcolor”: color-string or color-tuple</li> <li>“pensize”: positive number</li> <li>“speed”: number in range 0..10</li> <li>“resizemode”: “auto” or “user” or “noresize”</li> <li>“stretchfactor”: (positive number, positive number)</li> <li>“outline”: positive number</li> <li>“tilt”: number</li> </ul> <p>This dictionary can be used as argument for a subsequent call to <a class="reference internal" href="#turtle.pen" title="turtle.pen"><tt class="xref py py-func docutils literal"><span class="pre">pen()</span></tt></a> to restore the former pen-state. Moreover one or more of these attributes can be provided as keyword-arguments. This can be used to set several pen attributes in one statement.</p> <div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">pen</span><span class="p">(</span><span class="n">fillcolor</span><span class="o">=</span><span class="s">"black"</span><span class="p">,</span> <span class="n">pencolor</span><span class="o">=</span><span class="s">"red"</span><span class="p">,</span> <span class="n">pensize</span><span class="o">=</span><span class="mi">10</span><span class="p">)</span> <span class="gp">>>> </span><span class="nb">sorted</span><span class="p">(</span><span class="n">turtle</span><span class="o">.</span><span class="n">pen</span><span class="p">()</span><span class="o">.</span><span class="n">items</span><span class="p">())</span> <span class="go">[('fillcolor', 'black'), ('outline', 1), ('pencolor', 'red'),</span> <span class="go"> ('pendown', True), ('pensize', 10), ('resizemode', 'noresize'),</span> <span class="go"> ('shown', True), ('speed', 9), ('stretchfactor', (1, 1)), ('tilt', 0)]</span> <span class="gp">>>> </span><span class="n">penstate</span><span class="o">=</span><span class="n">turtle</span><span class="o">.</span><span class="n">pen</span><span class="p">()</span> <span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">color</span><span class="p">(</span><span class="s">"yellow"</span><span class="p">,</span> <span class="s">""</span><span class="p">)</span> <span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">penup</span><span class="p">()</span> <span class="gp">>>> </span><span class="nb">sorted</span><span class="p">(</span><span class="n">turtle</span><span class="o">.</span><span class="n">pen</span><span class="p">()</span><span class="o">.</span><span class="n">items</span><span class="p">())</span> <span class="go">[('fillcolor', ''), ('outline', 1), ('pencolor', 'yellow'),</span> <span class="go"> ('pendown', False), ('pensize', 10), ('resizemode', 'noresize'),</span> <span class="go"> ('shown', True), ('speed', 9), ('stretchfactor', (1, 1)), ('tilt', 0)]</span> <span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">pen</span><span class="p">(</span><span class="n">penstate</span><span class="p">,</span> <span class="n">fillcolor</span><span class="o">=</span><span class="s">"green"</span><span class="p">)</span> <span class="gp">>>> </span><span class="nb">sorted</span><span class="p">(</span><span class="n">turtle</span><span class="o">.</span><span class="n">pen</span><span class="p">()</span><span class="o">.</span><span class="n">items</span><span class="p">())</span> <span class="go">[('fillcolor', 'green'), ('outline', 1), ('pencolor', 'red'),</span> <span class="go"> ('pendown', True), ('pensize', 10), ('resizemode', 'noresize'),</span> <span class="go"> ('shown', True), ('speed', 9), ('stretchfactor', (1, 1)), ('tilt', 0)]</span> </pre></div> </div> </dd></dl> <dl class="function"> <dt id="turtle.isdown"> <tt class="descclassname">turtle.</tt><tt class="descname">isdown</tt><big>(</big><big>)</big><a class="headerlink" href="#turtle.isdown" title="Permalink to this definition">¶</a></dt> <dd><p>Return <tt class="docutils literal"><span class="pre">True</span></tt> if pen is down, <tt class="docutils literal"><span class="pre">False</span></tt> if it’s up.</p> <div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">penup</span><span class="p">()</span> <span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">isdown</span><span class="p">()</span> <span class="go">False</span> <span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">pendown</span><span class="p">()</span> <span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">isdown</span><span class="p">()</span> <span class="go">True</span> </pre></div> </div> </dd></dl> </div> <div class="section" id="color-control"> <h4>24.5.3.4.2. Color control<a class="headerlink" href="#color-control" title="Permalink to this headline">¶</a></h4> <dl class="function"> <dt id="turtle.pencolor"> <tt class="descclassname">turtle.</tt><tt class="descname">pencolor</tt><big>(</big><em>*args</em><big>)</big><a class="headerlink" href="#turtle.pencolor" title="Permalink to this definition">¶</a></dt> <dd><p>Return or set the pencolor.</p> <p>Four input formats are allowed:</p> <dl class="docutils"> <dt><tt class="docutils literal"><span class="pre">pencolor()</span></tt></dt> <dd>Return the current pencolor as color specification string or as a tuple (see example). May be used as input to another color/pencolor/fillcolor call.</dd> <dt><tt class="docutils literal"><span class="pre">pencolor(colorstring)</span></tt></dt> <dd>Set pencolor to <em>colorstring</em>, which is a Tk color specification string, such as <tt class="docutils literal"><span class="pre">"red"</span></tt>, <tt class="docutils literal"><span class="pre">"yellow"</span></tt>, or <tt class="docutils literal"><span class="pre">"#33cc8c"</span></tt>.</dd> <dt><tt class="docutils literal"><span class="pre">pencolor((r,</span> <span class="pre">g,</span> <span class="pre">b))</span></tt></dt> <dd>Set pencolor to the RGB color represented by the tuple of <em>r</em>, <em>g</em>, and <em>b</em>. Each of <em>r</em>, <em>g</em>, and <em>b</em> must be in the range 0..colormode, where colormode is either 1.0 or 255 (see <a class="reference internal" href="#turtle.colormode" title="turtle.colormode"><tt class="xref py py-func docutils literal"><span class="pre">colormode()</span></tt></a>).</dd> <dt><tt class="docutils literal"><span class="pre">pencolor(r,</span> <span class="pre">g,</span> <span class="pre">b)</span></tt></dt> <dd><blockquote class="first"> <div>Set pencolor to the RGB color represented by <em>r</em>, <em>g</em>, and <em>b</em>. Each of <em>r</em>, <em>g</em>, and <em>b</em> must be in the range 0..colormode.</div></blockquote> <p class="last">If turtleshape is a polygon, the outline of that polygon is drawn with the newly set pencolor.</p> </dd> </dl> <div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="n">colormode</span><span class="p">()</span> <span class="go">1.0</span> <span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">pencolor</span><span class="p">()</span> <span class="go">'red'</span> <span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">pencolor</span><span class="p">(</span><span class="s">"brown"</span><span class="p">)</span> <span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">pencolor</span><span class="p">()</span> <span class="go">'brown'</span> <span class="gp">>>> </span><span class="n">tup</span> <span class="o">=</span> <span class="p">(</span><span class="mf">0.2</span><span class="p">,</span> <span class="mf">0.8</span><span class="p">,</span> <span class="mf">0.55</span><span class="p">)</span> <span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">pencolor</span><span class="p">(</span><span class="n">tup</span><span class="p">)</span> <span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">pencolor</span><span class="p">()</span> <span class="go">(0.2, 0.8, 0.5490196078431373)</span> <span class="gp">>>> </span><span class="n">colormode</span><span class="p">(</span><span class="mi">255</span><span class="p">)</span> <span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">pencolor</span><span class="p">()</span> <span class="go">(51, 204, 140)</span> <span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">pencolor</span><span class="p">(</span><span class="s">'#32c18f'</span><span class="p">)</span> <span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">pencolor</span><span class="p">()</span> <span class="go">(50, 193, 143)</span> </pre></div> </div> </dd></dl> <dl class="function"> <dt id="turtle.fillcolor"> <tt class="descclassname">turtle.</tt><tt class="descname">fillcolor</tt><big>(</big><em>*args</em><big>)</big><a class="headerlink" href="#turtle.fillcolor" title="Permalink to this definition">¶</a></dt> <dd><p>Return or set the fillcolor.</p> <p>Four input formats are allowed:</p> <dl class="docutils"> <dt><tt class="docutils literal"><span class="pre">fillcolor()</span></tt></dt> <dd>Return the current fillcolor as color specification string, possibly in tuple format (see example). May be used as input to another color/pencolor/fillcolor call.</dd> <dt><tt class="docutils literal"><span class="pre">fillcolor(colorstring)</span></tt></dt> <dd>Set fillcolor to <em>colorstring</em>, which is a Tk color specification string, such as <tt class="docutils literal"><span class="pre">"red"</span></tt>, <tt class="docutils literal"><span class="pre">"yellow"</span></tt>, or <tt class="docutils literal"><span class="pre">"#33cc8c"</span></tt>.</dd> <dt><tt class="docutils literal"><span class="pre">fillcolor((r,</span> <span class="pre">g,</span> <span class="pre">b))</span></tt></dt> <dd>Set fillcolor to the RGB color represented by the tuple of <em>r</em>, <em>g</em>, and <em>b</em>. Each of <em>r</em>, <em>g</em>, and <em>b</em> must be in the range 0..colormode, where colormode is either 1.0 or 255 (see <a class="reference internal" href="#turtle.colormode" title="turtle.colormode"><tt class="xref py py-func docutils literal"><span class="pre">colormode()</span></tt></a>).</dd> <dt><tt class="docutils literal"><span class="pre">fillcolor(r,</span> <span class="pre">g,</span> <span class="pre">b)</span></tt></dt> <dd><blockquote class="first"> <div>Set fillcolor to the RGB color represented by <em>r</em>, <em>g</em>, and <em>b</em>. Each of <em>r</em>, <em>g</em>, and <em>b</em> must be in the range 0..colormode.</div></blockquote> <p class="last">If turtleshape is a polygon, the interior of that polygon is drawn with the newly set fillcolor.</p> </dd> </dl> <div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">fillcolor</span><span class="p">(</span><span class="s">"violet"</span><span class="p">)</span> <span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">fillcolor</span><span class="p">()</span> <span class="go">'violet'</span> <span class="gp">>>> </span><span class="n">col</span> <span class="o">=</span> <span class="n">turtle</span><span class="o">.</span><span class="n">pencolor</span><span class="p">()</span> <span class="gp">>>> </span><span class="n">col</span> <span class="go">(50, 193, 143)</span> <span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">fillcolor</span><span class="p">(</span><span class="n">col</span><span class="p">)</span> <span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">fillcolor</span><span class="p">()</span> <span class="go">(50, 193, 143)</span> <span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">fillcolor</span><span class="p">(</span><span class="s">'#ffffff'</span><span class="p">)</span> <span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">fillcolor</span><span class="p">()</span> <span class="go">(255, 255, 255)</span> </pre></div> </div> </dd></dl> <dl class="function"> <dt id="turtle.color"> <tt class="descclassname">turtle.</tt><tt class="descname">color</tt><big>(</big><em>*args</em><big>)</big><a class="headerlink" href="#turtle.color" title="Permalink to this definition">¶</a></dt> <dd><p>Return or set pencolor and fillcolor.</p> <p>Several input formats are allowed. They use 0 to 3 arguments as follows:</p> <dl class="docutils"> <dt><tt class="docutils literal"><span class="pre">color()</span></tt></dt> <dd>Return the current pencolor and the current fillcolor as a pair of color specification strings or tuples as returned by <a class="reference internal" href="#turtle.pencolor" title="turtle.pencolor"><tt class="xref py py-func docutils literal"><span class="pre">pencolor()</span></tt></a> and <a class="reference internal" href="#turtle.fillcolor" title="turtle.fillcolor"><tt class="xref py py-func docutils literal"><span class="pre">fillcolor()</span></tt></a>.</dd> <dt><tt class="docutils literal"><span class="pre">color(colorstring)</span></tt>, <tt class="docutils literal"><span class="pre">color((r,g,b))</span></tt>, <tt class="docutils literal"><span class="pre">color(r,g,b)</span></tt></dt> <dd>Inputs as in <a class="reference internal" href="#turtle.pencolor" title="turtle.pencolor"><tt class="xref py py-func docutils literal"><span class="pre">pencolor()</span></tt></a>, set both, fillcolor and pencolor, to the given value.</dd> <dt><tt class="docutils literal"><span class="pre">color(colorstring1,</span> <span class="pre">colorstring2)</span></tt>, <tt class="docutils literal"><span class="pre">color((r1,g1,b1),</span> <span class="pre">(r2,g2,b2))</span></tt></dt> <dd><blockquote class="first"> <div>Equivalent to <tt class="docutils literal"><span class="pre">pencolor(colorstring1)</span></tt> and <tt class="docutils literal"><span class="pre">fillcolor(colorstring2)</span></tt> and analogously if the other input format is used.</div></blockquote> <p class="last">If turtleshape is a polygon, outline and interior of that polygon is drawn with the newly set colors.</p> </dd> </dl> <div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">color</span><span class="p">(</span><span class="s">"red"</span><span class="p">,</span> <span class="s">"green"</span><span class="p">)</span> <span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">color</span><span class="p">()</span> <span class="go">('red', 'green')</span> <span class="gp">>>> </span><span class="n">color</span><span class="p">(</span><span class="s">"#285078"</span><span class="p">,</span> <span class="s">"#a0c8f0"</span><span class="p">)</span> <span class="gp">>>> </span><span class="n">color</span><span class="p">()</span> <span class="go">((40, 80, 120), (160, 200, 240))</span> </pre></div> </div> </dd></dl> <p>See also: Screen method <a class="reference internal" href="#turtle.colormode" title="turtle.colormode"><tt class="xref py py-func docutils literal"><span class="pre">colormode()</span></tt></a>.</p> </div> <div class="section" id="filling"> <h4>24.5.3.4.3. Filling<a class="headerlink" href="#filling" title="Permalink to this headline">¶</a></h4> <dl class="function"> <dt id="turtle.fill"> <tt class="descclassname">turtle.</tt><tt class="descname">fill</tt><big>(</big><em>flag</em><big>)</big><a class="headerlink" href="#turtle.fill" title="Permalink to this definition">¶</a></dt> <dd><table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>flag</strong> – True/False (or 1/0 respectively)</td> </tr> </tbody> </table> <p>Call <tt class="docutils literal"><span class="pre">fill(True)</span></tt> before drawing the shape you want to fill, and <tt class="docutils literal"><span class="pre">fill(False)</span></tt> when done. When used without argument: return fillstate (<tt class="docutils literal"><span class="pre">True</span></tt> if filling, <tt class="docutils literal"><span class="pre">False</span></tt> else).</p> <div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">fill</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span> <span class="gp">>>> </span><span class="k">for</span> <span class="n">_</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="mi">3</span><span class="p">):</span> <span class="gp">... </span> <span class="n">turtle</span><span class="o">.</span><span class="n">forward</span><span class="p">(</span><span class="mi">100</span><span class="p">)</span> <span class="gp">... </span> <span class="n">turtle</span><span class="o">.</span><span class="n">left</span><span class="p">(</span><span class="mi">120</span><span class="p">)</span> <span class="gp">...</span> <span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">fill</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span> </pre></div> </div> </dd></dl> <dl class="function"> <dt id="turtle.begin_fill"> <tt class="descclassname">turtle.</tt><tt class="descname">begin_fill</tt><big>(</big><big>)</big><a class="headerlink" href="#turtle.begin_fill" title="Permalink to this definition">¶</a></dt> <dd><p>Call just before drawing a shape to be filled. Equivalent to <tt class="docutils literal"><span class="pre">fill(True)</span></tt>.</p> </dd></dl> <dl class="function"> <dt id="turtle.end_fill"> <tt class="descclassname">turtle.</tt><tt class="descname">end_fill</tt><big>(</big><big>)</big><a class="headerlink" href="#turtle.end_fill" title="Permalink to this definition">¶</a></dt> <dd><p>Fill the shape drawn after the last call to <a class="reference internal" href="#turtle.begin_fill" title="turtle.begin_fill"><tt class="xref py py-func docutils literal"><span class="pre">begin_fill()</span></tt></a>. Equivalent to <tt class="docutils literal"><span class="pre">fill(False)</span></tt>.</p> <div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">color</span><span class="p">(</span><span class="s">"black"</span><span class="p">,</span> <span class="s">"red"</span><span class="p">)</span> <span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">begin_fill</span><span class="p">()</span> <span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">circle</span><span class="p">(</span><span class="mi">80</span><span class="p">)</span> <span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">end_fill</span><span class="p">()</span> </pre></div> </div> </dd></dl> </div> <div class="section" id="more-drawing-control"> <h4>24.5.3.4.4. More drawing control<a class="headerlink" href="#more-drawing-control" title="Permalink to this headline">¶</a></h4> <dl class="function"> <dt id="turtle.reset"> <tt class="descclassname">turtle.</tt><tt class="descname">reset</tt><big>(</big><big>)</big><a class="headerlink" href="#turtle.reset" title="Permalink to this definition">¶</a></dt> <dd><p>Delete the turtle’s drawings from the screen, re-center the turtle and set variables to the default values.</p> <div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">goto</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span><span class="o">-</span><span class="mi">22</span><span class="p">)</span> <span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">left</span><span class="p">(</span><span class="mi">100</span><span class="p">)</span> <span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">position</span><span class="p">()</span> <span class="go">(0.00,-22.00)</span> <span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">heading</span><span class="p">()</span> <span class="go">100.0</span> <span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">reset</span><span class="p">()</span> <span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">position</span><span class="p">()</span> <span class="go">(0.00,0.00)</span> <span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">heading</span><span class="p">()</span> <span class="go">0.0</span> </pre></div> </div> </dd></dl> <dl class="function"> <dt id="turtle.clear"> <tt class="descclassname">turtle.</tt><tt class="descname">clear</tt><big>(</big><big>)</big><a class="headerlink" href="#turtle.clear" title="Permalink to this definition">¶</a></dt> <dd><p>Delete the turtle’s drawings from the screen. Do not move turtle. State and position of the turtle as well as drawings of other turtles are not affected.</p> </dd></dl> <dl class="function"> <dt id="turtle.write"> <tt class="descclassname">turtle.</tt><tt class="descname">write</tt><big>(</big><em>arg</em>, <em>move=False</em>, <em>align="left"</em>, <em>font=("Arial"</em>, <em>8</em>, <em>"normal")</em><big>)</big><a class="headerlink" href="#turtle.write" title="Permalink to this definition">¶</a></dt> <dd><table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple"> <li><strong>arg</strong> – object to be written to the TurtleScreen</li> <li><strong>move</strong> – True/False</li> <li><strong>align</strong> – one of the strings “left”, “center” or right”</li> <li><strong>font</strong> – a triple (fontname, fontsize, fonttype)</li> </ul> </td> </tr> </tbody> </table> <p>Write text - the string representation of <em>arg</em> - at the current turtle position according to <em>align</em> (“left”, “center” or right”) and with the given font. If <em>move</em> is True, the pen is moved to the bottom-right corner of the text. By default, <em>move</em> is False.</p> <div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="s">"Home = "</span><span class="p">,</span> <span class="bp">True</span><span class="p">,</span> <span class="n">align</span><span class="o">=</span><span class="s">"center"</span><span class="p">)</span> <span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">write</span><span class="p">((</span><span class="mi">0</span><span class="p">,</span><span class="mi">0</span><span class="p">),</span> <span class="bp">True</span><span class="p">)</span> </pre></div> </div> </dd></dl> </div> </div> <div class="section" id="turtle-state"> <h3>24.5.3.5. Turtle state<a class="headerlink" href="#turtle-state" title="Permalink to this headline">¶</a></h3> <div class="section" id="visibility"> <h4>24.5.3.5.1. Visibility<a class="headerlink" href="#visibility" title="Permalink to this headline">¶</a></h4> <dl class="function"> <dt id="turtle.hideturtle"> <tt class="descclassname">turtle.</tt><tt class="descname">hideturtle</tt><big>(</big><big>)</big><a class="headerlink" href="#turtle.hideturtle" title="Permalink to this definition">¶</a></dt> <dt id="turtle.ht"> <tt class="descclassname">turtle.</tt><tt class="descname">ht</tt><big>(</big><big>)</big><a class="headerlink" href="#turtle.ht" title="Permalink to this definition">¶</a></dt> <dd><p>Make the turtle invisible. It’s a good idea to do this while you’re in the middle of doing some complex drawing, because hiding the turtle speeds up the drawing observably.</p> <div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">hideturtle</span><span class="p">()</span> </pre></div> </div> </dd></dl> <dl class="function"> <dt id="turtle.showturtle"> <tt class="descclassname">turtle.</tt><tt class="descname">showturtle</tt><big>(</big><big>)</big><a class="headerlink" href="#turtle.showturtle" title="Permalink to this definition">¶</a></dt> <dt id="turtle.st"> <tt class="descclassname">turtle.</tt><tt class="descname">st</tt><big>(</big><big>)</big><a class="headerlink" href="#turtle.st" title="Permalink to this definition">¶</a></dt> <dd><p>Make the turtle visible.</p> <div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">showturtle</span><span class="p">()</span> </pre></div> </div> </dd></dl> <dl class="function"> <dt id="turtle.isvisible"> <tt class="descclassname">turtle.</tt><tt class="descname">isvisible</tt><big>(</big><big>)</big><a class="headerlink" href="#turtle.isvisible" title="Permalink to this definition">¶</a></dt> <dd><p>Return True if the Turtle is shown, False if it’s hidden.</p> <div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">hideturtle</span><span class="p">()</span> <span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">isvisible</span><span class="p">()</span> <span class="go">False</span> <span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">showturtle</span><span class="p">()</span> <span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">isvisible</span><span class="p">()</span> <span class="go">True</span> </pre></div> </div> </dd></dl> </div> <div class="section" id="appearance"> <h4>24.5.3.5.2. Appearance<a class="headerlink" href="#appearance" title="Permalink to this headline">¶</a></h4> <dl class="function"> <dt id="turtle.shape"> <tt class="descclassname">turtle.</tt><tt class="descname">shape</tt><big>(</big><em>name=None</em><big>)</big><a class="headerlink" href="#turtle.shape" title="Permalink to this definition">¶</a></dt> <dd><table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>name</strong> – a string which is a valid shapename</td> </tr> </tbody> </table> <p>Set turtle shape to shape with given <em>name</em> or, if name is not given, return name of current shape. Shape with <em>name</em> must exist in the TurtleScreen’s shape dictionary. Initially there are the following polygon shapes: “arrow”, “turtle”, “circle”, “square”, “triangle”, “classic”. To learn about how to deal with shapes see Screen method <a class="reference internal" href="#turtle.register_shape" title="turtle.register_shape"><tt class="xref py py-func docutils literal"><span class="pre">register_shape()</span></tt></a>.</p> <div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">shape</span><span class="p">()</span> <span class="go">'classic'</span> <span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">shape</span><span class="p">(</span><span class="s">"turtle"</span><span class="p">)</span> <span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">shape</span><span class="p">()</span> <span class="go">'turtle'</span> </pre></div> </div> </dd></dl> <dl class="function"> <dt id="turtle.resizemode"> <tt class="descclassname">turtle.</tt><tt class="descname">resizemode</tt><big>(</big><em>rmode=None</em><big>)</big><a class="headerlink" href="#turtle.resizemode" title="Permalink to this definition">¶</a></dt> <dd><table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>rmode</strong> – one of the strings “auto”, “user”, “noresize”</td> </tr> </tbody> </table> <p>Set resizemode to one of the values: “auto”, “user”, “noresize”. If <em>rmode</em> is not given, return current resizemode. Different resizemodes have the following effects:</p> <ul class="simple"> <li>“auto”: adapts the appearance of the turtle corresponding to the value of pensize.</li> <li>“user”: adapts the appearance of the turtle according to the values of stretchfactor and outlinewidth (outline), which are set by <a class="reference internal" href="#turtle.shapesize" title="turtle.shapesize"><tt class="xref py py-func docutils literal"><span class="pre">shapesize()</span></tt></a>.</li> <li>“noresize”: no adaption of the turtle’s appearance takes place.</li> </ul> <p>resizemode(“user”) is called by <a class="reference internal" href="#turtle.shapesize" title="turtle.shapesize"><tt class="xref py py-func docutils literal"><span class="pre">shapesize()</span></tt></a> when used with arguments.</p> <div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">resizemode</span><span class="p">()</span> <span class="go">'noresize'</span> <span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">resizemode</span><span class="p">(</span><span class="s">"auto"</span><span class="p">)</span> <span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">resizemode</span><span class="p">()</span> <span class="go">'auto'</span> </pre></div> </div> </dd></dl> <dl class="function"> <dt id="turtle.shapesize"> <tt class="descclassname">turtle.</tt><tt class="descname">shapesize</tt><big>(</big><em>stretch_wid=None</em>, <em>stretch_len=None</em>, <em>outline=None</em><big>)</big><a class="headerlink" href="#turtle.shapesize" title="Permalink to this definition">¶</a></dt> <dt id="turtle.turtlesize"> <tt class="descclassname">turtle.</tt><tt class="descname">turtlesize</tt><big>(</big><em>stretch_wid=None</em>, <em>stretch_len=None</em>, <em>outline=None</em><big>)</big><a class="headerlink" href="#turtle.turtlesize" title="Permalink to this definition">¶</a></dt> <dd><table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple"> <li><strong>stretch_wid</strong> – positive number</li> <li><strong>stretch_len</strong> – positive number</li> <li><strong>outline</strong> – positive number</li> </ul> </td> </tr> </tbody> </table> <p>Return or set the pen’s attributes x/y-stretchfactors and/or outline. Set resizemode to “user”. If and only if resizemode is set to “user”, the turtle will be displayed stretched according to its stretchfactors: <em>stretch_wid</em> is stretchfactor perpendicular to its orientation, <em>stretch_len</em> is stretchfactor in direction of its orientation, <em>outline</em> determines the width of the shapes’s outline.</p> <div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">shapesize</span><span class="p">()</span> <span class="go">(1, 1, 1)</span> <span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">resizemode</span><span class="p">(</span><span class="s">"user"</span><span class="p">)</span> <span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">shapesize</span><span class="p">(</span><span class="mi">5</span><span class="p">,</span> <span class="mi">5</span><span class="p">,</span> <span class="mi">12</span><span class="p">)</span> <span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">shapesize</span><span class="p">()</span> <span class="go">(5, 5, 12)</span> <span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">shapesize</span><span class="p">(</span><span class="n">outline</span><span class="o">=</span><span class="mi">8</span><span class="p">)</span> <span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">shapesize</span><span class="p">()</span> <span class="go">(5, 5, 8)</span> </pre></div> </div> </dd></dl> <dl class="function"> <dt id="turtle.tilt"> <tt class="descclassname">turtle.</tt><tt class="descname">tilt</tt><big>(</big><em>angle</em><big>)</big><a class="headerlink" href="#turtle.tilt" title="Permalink to this definition">¶</a></dt> <dd><table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>angle</strong> – a number</td> </tr> </tbody> </table> <p>Rotate the turtleshape by <em>angle</em> from its current tilt-angle, but do <em>not</em> change the turtle’s heading (direction of movement).</p> <div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">reset</span><span class="p">()</span> <span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">shape</span><span class="p">(</span><span class="s">"circle"</span><span class="p">)</span> <span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">shapesize</span><span class="p">(</span><span class="mi">5</span><span class="p">,</span><span class="mi">2</span><span class="p">)</span> <span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">tilt</span><span class="p">(</span><span class="mi">30</span><span class="p">)</span> <span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">fd</span><span class="p">(</span><span class="mi">50</span><span class="p">)</span> <span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">tilt</span><span class="p">(</span><span class="mi">30</span><span class="p">)</span> <span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">fd</span><span class="p">(</span><span class="mi">50</span><span class="p">)</span> </pre></div> </div> </dd></dl> <dl class="function"> <dt id="turtle.settiltangle"> <tt class="descclassname">turtle.</tt><tt class="descname">settiltangle</tt><big>(</big><em>angle</em><big>)</big><a class="headerlink" href="#turtle.settiltangle" title="Permalink to this definition">¶</a></dt> <dd><table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>angle</strong> – a number</td> </tr> </tbody> </table> <p>Rotate the turtleshape to point in the direction specified by <em>angle</em>, regardless of its current tilt-angle. <em>Do not</em> change the turtle’s heading (direction of movement).</p> <div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">reset</span><span class="p">()</span> <span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">shape</span><span class="p">(</span><span class="s">"circle"</span><span class="p">)</span> <span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">shapesize</span><span class="p">(</span><span class="mi">5</span><span class="p">,</span><span class="mi">2</span><span class="p">)</span> <span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">settiltangle</span><span class="p">(</span><span class="mi">45</span><span class="p">)</span> <span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">fd</span><span class="p">(</span><span class="mi">50</span><span class="p">)</span> <span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">settiltangle</span><span class="p">(</span><span class="o">-</span><span class="mi">45</span><span class="p">)</span> <span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">fd</span><span class="p">(</span><span class="mi">50</span><span class="p">)</span> </pre></div> </div> </dd></dl> <dl class="function"> <dt id="turtle.tiltangle"> <tt class="descclassname">turtle.</tt><tt class="descname">tiltangle</tt><big>(</big><big>)</big><a class="headerlink" href="#turtle.tiltangle" title="Permalink to this definition">¶</a></dt> <dd><p>Return the current tilt-angle, i.e. the angle between the orientation of the turtleshape and the heading of the turtle (its direction of movement).</p> <div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">reset</span><span class="p">()</span> <span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">shape</span><span class="p">(</span><span class="s">"circle"</span><span class="p">)</span> <span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">shapesize</span><span class="p">(</span><span class="mi">5</span><span class="p">,</span><span class="mi">2</span><span class="p">)</span> <span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">tilt</span><span class="p">(</span><span class="mi">45</span><span class="p">)</span> <span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">tiltangle</span><span class="p">()</span> <span class="go">45.0</span> </pre></div> </div> </dd></dl> </div> </div> <div class="section" id="using-events"> <h3>24.5.3.6. Using events<a class="headerlink" href="#using-events" title="Permalink to this headline">¶</a></h3> <dl class="function"> <dt id="turtle.onclick"> <tt class="descclassname">turtle.</tt><tt class="descname">onclick</tt><big>(</big><em>fun</em>, <em>btn=1</em>, <em>add=None</em><big>)</big><a class="headerlink" href="#turtle.onclick" title="Permalink to this definition">¶</a></dt> <dd><table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple"> <li><strong>fun</strong> – a function with two arguments which will be called with the coordinates of the clicked point on the canvas</li> <li><strong>num</strong> – number of the mouse-button, defaults to 1 (left mouse button)</li> <li><strong>add</strong> – <tt class="docutils literal"><span class="pre">True</span></tt> or <tt class="docutils literal"><span class="pre">False</span></tt> – if <tt class="docutils literal"><span class="pre">True</span></tt>, a new binding will be added, otherwise it will replace a former binding</li> </ul> </td> </tr> </tbody> </table> <p>Bind <em>fun</em> to mouse-click events on this turtle. If <em>fun</em> is <tt class="docutils literal"><span class="pre">None</span></tt>, existing bindings are removed. Example for the anonymous turtle, i.e. the procedural way:</p> <div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="k">def</span> <span class="nf">turn</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">y</span><span class="p">):</span> <span class="gp">... </span> <span class="n">left</span><span class="p">(</span><span class="mi">180</span><span class="p">)</span> <span class="gp">...</span> <span class="gp">>>> </span><span class="n">onclick</span><span class="p">(</span><span class="n">turn</span><span class="p">)</span> <span class="c"># Now clicking into the turtle will turn it.</span> <span class="gp">>>> </span><span class="n">onclick</span><span class="p">(</span><span class="bp">None</span><span class="p">)</span> <span class="c"># event-binding will be removed</span> </pre></div> </div> </dd></dl> <dl class="function"> <dt id="turtle.onrelease"> <tt class="descclassname">turtle.</tt><tt class="descname">onrelease</tt><big>(</big><em>fun</em>, <em>btn=1</em>, <em>add=None</em><big>)</big><a class="headerlink" href="#turtle.onrelease" title="Permalink to this definition">¶</a></dt> <dd><table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple"> <li><strong>fun</strong> – a function with two arguments which will be called with the coordinates of the clicked point on the canvas</li> <li><strong>num</strong> – number of the mouse-button, defaults to 1 (left mouse button)</li> <li><strong>add</strong> – <tt class="docutils literal"><span class="pre">True</span></tt> or <tt class="docutils literal"><span class="pre">False</span></tt> – if <tt class="docutils literal"><span class="pre">True</span></tt>, a new binding will be added, otherwise it will replace a former binding</li> </ul> </td> </tr> </tbody> </table> <p>Bind <em>fun</em> to mouse-button-release events on this turtle. If <em>fun</em> is <tt class="docutils literal"><span class="pre">None</span></tt>, existing bindings are removed.</p> <div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="k">class</span> <span class="nc">MyTurtle</span><span class="p">(</span><span class="n">Turtle</span><span class="p">):</span> <span class="gp">... </span> <span class="k">def</span> <span class="nf">glow</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span><span class="n">x</span><span class="p">,</span><span class="n">y</span><span class="p">):</span> <span class="gp">... </span> <span class="bp">self</span><span class="o">.</span><span class="n">fillcolor</span><span class="p">(</span><span class="s">"red"</span><span class="p">)</span> <span class="gp">... </span> <span class="k">def</span> <span class="nf">unglow</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span><span class="n">x</span><span class="p">,</span><span class="n">y</span><span class="p">):</span> <span class="gp">... </span> <span class="bp">self</span><span class="o">.</span><span class="n">fillcolor</span><span class="p">(</span><span class="s">""</span><span class="p">)</span> <span class="gp">...</span> <span class="gp">>>> </span><span class="n">turtle</span> <span class="o">=</span> <span class="n">MyTurtle</span><span class="p">()</span> <span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">onclick</span><span class="p">(</span><span class="n">turtle</span><span class="o">.</span><span class="n">glow</span><span class="p">)</span> <span class="c"># clicking on turtle turns fillcolor red,</span> <span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">onrelease</span><span class="p">(</span><span class="n">turtle</span><span class="o">.</span><span class="n">unglow</span><span class="p">)</span> <span class="c"># releasing turns it to transparent.</span> </pre></div> </div> </dd></dl> <dl class="function"> <dt id="turtle.ondrag"> <tt class="descclassname">turtle.</tt><tt class="descname">ondrag</tt><big>(</big><em>fun</em>, <em>btn=1</em>, <em>add=None</em><big>)</big><a class="headerlink" href="#turtle.ondrag" title="Permalink to this definition">¶</a></dt> <dd><table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple"> <li><strong>fun</strong> – a function with two arguments which will be called with the coordinates of the clicked point on the canvas</li> <li><strong>num</strong> – number of the mouse-button, defaults to 1 (left mouse button)</li> <li><strong>add</strong> – <tt class="docutils literal"><span class="pre">True</span></tt> or <tt class="docutils literal"><span class="pre">False</span></tt> – if <tt class="docutils literal"><span class="pre">True</span></tt>, a new binding will be added, otherwise it will replace a former binding</li> </ul> </td> </tr> </tbody> </table> <p>Bind <em>fun</em> to mouse-move events on this turtle. If <em>fun</em> is <tt class="docutils literal"><span class="pre">None</span></tt>, existing bindings are removed.</p> <p>Remark: Every sequence of mouse-move-events on a turtle is preceded by a mouse-click event on that turtle.</p> <div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">ondrag</span><span class="p">(</span><span class="n">turtle</span><span class="o">.</span><span class="n">goto</span><span class="p">)</span> </pre></div> </div> <p>Subsequently, clicking and dragging the Turtle will move it across the screen thereby producing handdrawings (if pen is down).</p> </dd></dl> <dl class="function"> <dt id="turtle.mainloop"> <tt class="descclassname">turtle.</tt><tt class="descname">mainloop</tt><big>(</big><big>)</big><a class="headerlink" href="#turtle.mainloop" title="Permalink to this definition">¶</a></dt> <dt id="turtle.done"> <tt class="descclassname">turtle.</tt><tt class="descname">done</tt><big>(</big><big>)</big><a class="headerlink" href="#turtle.done" title="Permalink to this definition">¶</a></dt> <dd><p>Starts event loop - calling Tkinter’s mainloop function. Must be the last statement in a turtle graphics program.</p> <div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">mainloop</span><span class="p">()</span> </pre></div> </div> </dd></dl> </div> <div class="section" id="special-turtle-methods"> <h3>24.5.3.7. Special Turtle methods<a class="headerlink" href="#special-turtle-methods" title="Permalink to this headline">¶</a></h3> <dl class="function"> <dt id="turtle.begin_poly"> <tt class="descclassname">turtle.</tt><tt class="descname">begin_poly</tt><big>(</big><big>)</big><a class="headerlink" href="#turtle.begin_poly" title="Permalink to this definition">¶</a></dt> <dd><p>Start recording the vertices of a polygon. Current turtle position is first vertex of polygon.</p> </dd></dl> <dl class="function"> <dt id="turtle.end_poly"> <tt class="descclassname">turtle.</tt><tt class="descname">end_poly</tt><big>(</big><big>)</big><a class="headerlink" href="#turtle.end_poly" title="Permalink to this definition">¶</a></dt> <dd><p>Stop recording the vertices of a polygon. Current turtle position is last vertex of polygon. This will be connected with the first vertex.</p> </dd></dl> <dl class="function"> <dt id="turtle.get_poly"> <tt class="descclassname">turtle.</tt><tt class="descname">get_poly</tt><big>(</big><big>)</big><a class="headerlink" href="#turtle.get_poly" title="Permalink to this definition">¶</a></dt> <dd><p>Return the last recorded polygon.</p> <div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">home</span><span class="p">()</span> <span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">begin_poly</span><span class="p">()</span> <span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">fd</span><span class="p">(</span><span class="mi">100</span><span class="p">)</span> <span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">left</span><span class="p">(</span><span class="mi">20</span><span class="p">)</span> <span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">fd</span><span class="p">(</span><span class="mi">30</span><span class="p">)</span> <span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">left</span><span class="p">(</span><span class="mi">60</span><span class="p">)</span> <span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">fd</span><span class="p">(</span><span class="mi">50</span><span class="p">)</span> <span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">end_poly</span><span class="p">()</span> <span class="gp">>>> </span><span class="n">p</span> <span class="o">=</span> <span class="n">turtle</span><span class="o">.</span><span class="n">get_poly</span><span class="p">()</span> <span class="gp">>>> </span><span class="n">register_shape</span><span class="p">(</span><span class="s">"myFavouriteShape"</span><span class="p">,</span> <span class="n">p</span><span class="p">)</span> </pre></div> </div> </dd></dl> <dl class="function"> <dt id="turtle.clone"> <tt class="descclassname">turtle.</tt><tt class="descname">clone</tt><big>(</big><big>)</big><a class="headerlink" href="#turtle.clone" title="Permalink to this definition">¶</a></dt> <dd><p>Create and return a clone of the turtle with same position, heading and turtle properties.</p> <div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="n">mick</span> <span class="o">=</span> <span class="n">Turtle</span><span class="p">()</span> <span class="gp">>>> </span><span class="n">joe</span> <span class="o">=</span> <span class="n">mick</span><span class="o">.</span><span class="n">clone</span><span class="p">()</span> </pre></div> </div> </dd></dl> <dl class="function"> <dt id="turtle.getturtle"> <tt class="descclassname">turtle.</tt><tt class="descname">getturtle</tt><big>(</big><big>)</big><a class="headerlink" href="#turtle.getturtle" title="Permalink to this definition">¶</a></dt> <dt id="turtle.getpen"> <tt class="descclassname">turtle.</tt><tt class="descname">getpen</tt><big>(</big><big>)</big><a class="headerlink" href="#turtle.getpen" title="Permalink to this definition">¶</a></dt> <dd><p>Return the Turtle object itself. Only reasonable use: as a function to return the “anonymous turtle”:</p> <div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="n">pet</span> <span class="o">=</span> <span class="n">getturtle</span><span class="p">()</span> <span class="gp">>>> </span><span class="n">pet</span><span class="o">.</span><span class="n">fd</span><span class="p">(</span><span class="mi">50</span><span class="p">)</span> <span class="gp">>>> </span><span class="n">pet</span> <span class="go"><turtle.Turtle object at 0x...></span> </pre></div> </div> </dd></dl> <dl class="function"> <dt id="turtle.getscreen"> <tt class="descclassname">turtle.</tt><tt class="descname">getscreen</tt><big>(</big><big>)</big><a class="headerlink" href="#turtle.getscreen" title="Permalink to this definition">¶</a></dt> <dd><p>Return the <a class="reference internal" href="#turtle.TurtleScreen" title="turtle.TurtleScreen"><tt class="xref py py-class docutils literal"><span class="pre">TurtleScreen</span></tt></a> object the turtle is drawing on. TurtleScreen methods can then be called for that object.</p> <div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="n">ts</span> <span class="o">=</span> <span class="n">turtle</span><span class="o">.</span><span class="n">getscreen</span><span class="p">()</span> <span class="gp">>>> </span><span class="n">ts</span> <span class="go"><turtle._Screen object at 0x...></span> <span class="gp">>>> </span><span class="n">ts</span><span class="o">.</span><span class="n">bgcolor</span><span class="p">(</span><span class="s">"pink"</span><span class="p">)</span> </pre></div> </div> </dd></dl> <dl class="function"> <dt id="turtle.setundobuffer"> <tt class="descclassname">turtle.</tt><tt class="descname">setundobuffer</tt><big>(</big><em>size</em><big>)</big><a class="headerlink" href="#turtle.setundobuffer" title="Permalink to this definition">¶</a></dt> <dd><table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>size</strong> – an integer or <tt class="docutils literal"><span class="pre">None</span></tt></td> </tr> </tbody> </table> <p>Set or disable undobuffer. If <em>size</em> is an integer an empty undobuffer of given size is installed. <em>size</em> gives the maximum number of turtle actions that can be undone by the <a class="reference internal" href="#turtle.undo" title="turtle.undo"><tt class="xref py py-func docutils literal"><span class="pre">undo()</span></tt></a> method/function. If <em>size</em> is <tt class="docutils literal"><span class="pre">None</span></tt>, the undobuffer is disabled.</p> <div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">setundobuffer</span><span class="p">(</span><span class="mi">42</span><span class="p">)</span> </pre></div> </div> </dd></dl> <dl class="function"> <dt id="turtle.undobufferentries"> <tt class="descclassname">turtle.</tt><tt class="descname">undobufferentries</tt><big>(</big><big>)</big><a class="headerlink" href="#turtle.undobufferentries" title="Permalink to this definition">¶</a></dt> <dd><p>Return number of entries in the undobuffer.</p> <div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="k">while</span> <span class="n">undobufferentries</span><span class="p">():</span> <span class="gp">... </span> <span class="n">undo</span><span class="p">()</span> </pre></div> </div> </dd></dl> <dl class="function"> <dt id="turtle.tracer"> <tt class="descclassname">turtle.</tt><tt class="descname">tracer</tt><big>(</big><em>flag=None</em>, <em>delay=None</em><big>)</big><a class="headerlink" href="#turtle.tracer" title="Permalink to this definition">¶</a></dt> <dd><p>A replica of the corresponding TurtleScreen method.</p> <p class="deprecated"> <span class="versionmodified">Deprecated since version 2.6.</span></p> </dd></dl> <dl class="function"> <dt id="turtle.window_width"> <tt class="descclassname">turtle.</tt><tt class="descname">window_width</tt><big>(</big><big>)</big><a class="headerlink" href="#turtle.window_width" title="Permalink to this definition">¶</a></dt> <dt id="turtle.window_height"> <tt class="descclassname">turtle.</tt><tt class="descname">window_height</tt><big>(</big><big>)</big><a class="headerlink" href="#turtle.window_height" title="Permalink to this definition">¶</a></dt> <dd><p>Both are replicas of the corresponding TurtleScreen methods.</p> <p class="deprecated"> <span class="versionmodified">Deprecated since version 2.6.</span></p> </dd></dl> </div> <div class="section" id="excursus-about-the-use-of-compound-shapes"> <span id="compoundshapes"></span><h3>24.5.3.8. Excursus about the use of compound shapes<a class="headerlink" href="#excursus-about-the-use-of-compound-shapes" title="Permalink to this headline">¶</a></h3> <p>To use compound turtle shapes, which consist of several polygons of different color, you must use the helper class <a class="reference internal" href="#turtle.Shape" title="turtle.Shape"><tt class="xref py py-class docutils literal"><span class="pre">Shape</span></tt></a> explicitly as described below:</p> <ol class="arabic"> <li><p class="first">Create an empty Shape object of type “compound”.</p> </li> <li><p class="first">Add as many components to this object as desired, using the <tt class="xref py py-meth docutils literal"><span class="pre">addcomponent()</span></tt> method.</p> <p>For example:</p> <div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="n">s</span> <span class="o">=</span> <span class="n">Shape</span><span class="p">(</span><span class="s">"compound"</span><span class="p">)</span> <span class="gp">>>> </span><span class="n">poly1</span> <span class="o">=</span> <span class="p">((</span><span class="mi">0</span><span class="p">,</span><span class="mi">0</span><span class="p">),(</span><span class="mi">10</span><span class="p">,</span><span class="o">-</span><span class="mi">5</span><span class="p">),(</span><span class="mi">0</span><span class="p">,</span><span class="mi">10</span><span class="p">),(</span><span class="o">-</span><span class="mi">10</span><span class="p">,</span><span class="o">-</span><span class="mi">5</span><span class="p">))</span> <span class="gp">>>> </span><span class="n">s</span><span class="o">.</span><span class="n">addcomponent</span><span class="p">(</span><span class="n">poly1</span><span class="p">,</span> <span class="s">"red"</span><span class="p">,</span> <span class="s">"blue"</span><span class="p">)</span> <span class="gp">>>> </span><span class="n">poly2</span> <span class="o">=</span> <span class="p">((</span><span class="mi">0</span><span class="p">,</span><span class="mi">0</span><span class="p">),(</span><span class="mi">10</span><span class="p">,</span><span class="o">-</span><span class="mi">5</span><span class="p">),(</span><span class="o">-</span><span class="mi">10</span><span class="p">,</span><span class="o">-</span><span class="mi">5</span><span class="p">))</span> <span class="gp">>>> </span><span class="n">s</span><span class="o">.</span><span class="n">addcomponent</span><span class="p">(</span><span class="n">poly2</span><span class="p">,</span> <span class="s">"blue"</span><span class="p">,</span> <span class="s">"red"</span><span class="p">)</span> </pre></div> </div> </li> <li><p class="first">Now add the Shape to the Screen’s shapelist and use it:</p> <div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="n">register_shape</span><span class="p">(</span><span class="s">"myshape"</span><span class="p">,</span> <span class="n">s</span><span class="p">)</span> <span class="gp">>>> </span><span class="n">shape</span><span class="p">(</span><span class="s">"myshape"</span><span class="p">)</span> </pre></div> </div> </li> </ol> <div class="admonition note"> <p class="first admonition-title">Note</p> <p class="last">The <a class="reference internal" href="#turtle.Shape" title="turtle.Shape"><tt class="xref py py-class docutils literal"><span class="pre">Shape</span></tt></a> class is used internally by the <a class="reference internal" href="#turtle.register_shape" title="turtle.register_shape"><tt class="xref py py-func docutils literal"><span class="pre">register_shape()</span></tt></a> method in different ways. The application programmer has to deal with the Shape class <em>only</em> when using compound shapes like shown above!</p> </div> </div> </div> <div class="section" id="methods-of-turtlescreen-screen-and-corresponding-functions"> <h2>24.5.4. Methods of TurtleScreen/Screen and corresponding functions<a class="headerlink" href="#methods-of-turtlescreen-screen-and-corresponding-functions" title="Permalink to this headline">¶</a></h2> <p>Most of the examples in this section refer to a TurtleScreen instance called <tt class="docutils literal"><span class="pre">screen</span></tt>.</p> <div class="section" id="window-control"> <h3>24.5.4.1. Window control<a class="headerlink" href="#window-control" title="Permalink to this headline">¶</a></h3> <dl class="function"> <dt id="turtle.bgcolor"> <tt class="descclassname">turtle.</tt><tt class="descname">bgcolor</tt><big>(</big><em>*args</em><big>)</big><a class="headerlink" href="#turtle.bgcolor" title="Permalink to this definition">¶</a></dt> <dd><table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>args</strong> – a color string or three numbers in the range 0..colormode or a 3-tuple of such numbers</td> </tr> </tbody> </table> <p>Set or return background color of the TurtleScreen.</p> <div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="n">screen</span><span class="o">.</span><span class="n">bgcolor</span><span class="p">(</span><span class="s">"orange"</span><span class="p">)</span> <span class="gp">>>> </span><span class="n">screen</span><span class="o">.</span><span class="n">bgcolor</span><span class="p">()</span> <span class="go">'orange'</span> <span class="gp">>>> </span><span class="n">screen</span><span class="o">.</span><span class="n">bgcolor</span><span class="p">(</span><span class="s">"#800080"</span><span class="p">)</span> <span class="gp">>>> </span><span class="n">screen</span><span class="o">.</span><span class="n">bgcolor</span><span class="p">()</span> <span class="go">(128, 0, 128)</span> </pre></div> </div> </dd></dl> <dl class="function"> <dt id="turtle.bgpic"> <tt class="descclassname">turtle.</tt><tt class="descname">bgpic</tt><big>(</big><em>picname=None</em><big>)</big><a class="headerlink" href="#turtle.bgpic" title="Permalink to this definition">¶</a></dt> <dd><table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>picname</strong> – a string, name of a gif-file or <tt class="docutils literal"><span class="pre">"nopic"</span></tt>, or <tt class="docutils literal"><span class="pre">None</span></tt></td> </tr> </tbody> </table> <p>Set background image or return name of current backgroundimage. If <em>picname</em> is a filename, set the corresponding image as background. If <em>picname</em> is <tt class="docutils literal"><span class="pre">"nopic"</span></tt>, delete background image, if present. If <em>picname</em> is <tt class="docutils literal"><span class="pre">None</span></tt>, return the filename of the current backgroundimage.</p> <div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="n">screen</span><span class="o">.</span><span class="n">bgpic</span><span class="p">()</span> <span class="go">'nopic'</span> <span class="gp">>>> </span><span class="n">screen</span><span class="o">.</span><span class="n">bgpic</span><span class="p">(</span><span class="s">"landscape.gif"</span><span class="p">)</span> <span class="gp">>>> </span><span class="n">screen</span><span class="o">.</span><span class="n">bgpic</span><span class="p">()</span> <span class="go">"landscape.gif"</span> </pre></div> </div> </dd></dl> <dl class="function"> <dt> <tt class="descclassname">turtle.</tt><tt class="descname">clear</tt><big>(</big><big>)</big></dt> <dt id="turtle.clearscreen"> <tt class="descclassname">turtle.</tt><tt class="descname">clearscreen</tt><big>(</big><big>)</big><a class="headerlink" href="#turtle.clearscreen" title="Permalink to this definition">¶</a></dt> <dd><p>Delete all drawings and all turtles from the TurtleScreen. Reset the now empty TurtleScreen to its initial state: white background, no background image, no event bindings and tracing on.</p> <div class="admonition note"> <p class="first admonition-title">Note</p> <p class="last">This TurtleScreen method is available as a global function only under the name <tt class="docutils literal"><span class="pre">clearscreen</span></tt>. The global function <tt class="docutils literal"><span class="pre">clear</span></tt> is another one derived from the Turtle method <tt class="docutils literal"><span class="pre">clear</span></tt>.</p> </div> </dd></dl> <dl class="function"> <dt> <tt class="descclassname">turtle.</tt><tt class="descname">reset</tt><big>(</big><big>)</big></dt> <dt id="turtle.resetscreen"> <tt class="descclassname">turtle.</tt><tt class="descname">resetscreen</tt><big>(</big><big>)</big><a class="headerlink" href="#turtle.resetscreen" title="Permalink to this definition">¶</a></dt> <dd><p>Reset all Turtles on the Screen to their initial state.</p> <div class="admonition note"> <p class="first admonition-title">Note</p> <p class="last">This TurtleScreen method is available as a global function only under the name <tt class="docutils literal"><span class="pre">resetscreen</span></tt>. The global function <tt class="docutils literal"><span class="pre">reset</span></tt> is another one derived from the Turtle method <tt class="docutils literal"><span class="pre">reset</span></tt>.</p> </div> </dd></dl> <dl class="function"> <dt id="turtle.screensize"> <tt class="descclassname">turtle.</tt><tt class="descname">screensize</tt><big>(</big><em>canvwidth=None</em>, <em>canvheight=None</em>, <em>bg=None</em><big>)</big><a class="headerlink" href="#turtle.screensize" title="Permalink to this definition">¶</a></dt> <dd><table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple"> <li><strong>canvwidth</strong> – positive integer, new width of canvas in pixels</li> <li><strong>canvheight</strong> – positive integer, new height of canvas in pixels</li> <li><strong>bg</strong> – colorstring or color-tuple, new background color</li> </ul> </td> </tr> </tbody> </table> <p>If no arguments are given, return current (canvaswidth, canvasheight). Else resize the canvas the turtles are drawing on. Do not alter the drawing window. To observe hidden parts of the canvas, use the scrollbars. With this method, one can make visible those parts of a drawing which were outside the canvas before.</p> <div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="n">screen</span><span class="o">.</span><span class="n">screensize</span><span class="p">()</span> <span class="go">(400, 300)</span> <span class="gp">>>> </span><span class="n">screen</span><span class="o">.</span><span class="n">screensize</span><span class="p">(</span><span class="mi">2000</span><span class="p">,</span><span class="mi">1500</span><span class="p">)</span> <span class="gp">>>> </span><span class="n">screen</span><span class="o">.</span><span class="n">screensize</span><span class="p">()</span> <span class="go">(2000, 1500)</span> </pre></div> </div> <p>e.g. to search for an erroneously escaped turtle ;-)</p> </dd></dl> <dl class="function"> <dt id="turtle.setworldcoordinates"> <tt class="descclassname">turtle.</tt><tt class="descname">setworldcoordinates</tt><big>(</big><em>llx</em>, <em>lly</em>, <em>urx</em>, <em>ury</em><big>)</big><a class="headerlink" href="#turtle.setworldcoordinates" title="Permalink to this definition">¶</a></dt> <dd><table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple"> <li><strong>llx</strong> – a number, x-coordinate of lower left corner of canvas</li> <li><strong>lly</strong> – a number, y-coordinate of lower left corner of canvas</li> <li><strong>urx</strong> – a number, x-coordinate of upper right corner of canvas</li> <li><strong>ury</strong> – a number, y-coordinate of upper right corner of canvas</li> </ul> </td> </tr> </tbody> </table> <p>Set up user-defined coordinate system and switch to mode “world” if necessary. This performs a <tt class="docutils literal"><span class="pre">screen.reset()</span></tt>. If mode “world” is already active, all drawings are redrawn according to the new coordinates.</p> <p><strong>ATTENTION</strong>: in user-defined coordinate systems angles may appear distorted.</p> <div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="n">screen</span><span class="o">.</span><span class="n">reset</span><span class="p">()</span> <span class="gp">>>> </span><span class="n">screen</span><span class="o">.</span><span class="n">setworldcoordinates</span><span class="p">(</span><span class="o">-</span><span class="mi">50</span><span class="p">,</span><span class="o">-</span><span class="mf">7.5</span><span class="p">,</span><span class="mi">50</span><span class="p">,</span><span class="mf">7.5</span><span class="p">)</span> <span class="gp">>>> </span><span class="k">for</span> <span class="n">_</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="mi">72</span><span class="p">):</span> <span class="gp">... </span> <span class="n">left</span><span class="p">(</span><span class="mi">10</span><span class="p">)</span> <span class="gp">...</span> <span class="gp">>>> </span><span class="k">for</span> <span class="n">_</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="mi">8</span><span class="p">):</span> <span class="gp">... </span> <span class="n">left</span><span class="p">(</span><span class="mi">45</span><span class="p">);</span> <span class="n">fd</span><span class="p">(</span><span class="mi">2</span><span class="p">)</span> <span class="c"># a regular octagon</span> </pre></div> </div> </dd></dl> </div> <div class="section" id="animation-control"> <h3>24.5.4.2. Animation control<a class="headerlink" href="#animation-control" title="Permalink to this headline">¶</a></h3> <dl class="function"> <dt id="turtle.delay"> <tt class="descclassname">turtle.</tt><tt class="descname">delay</tt><big>(</big><em>delay=None</em><big>)</big><a class="headerlink" href="#turtle.delay" title="Permalink to this definition">¶</a></dt> <dd><table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>delay</strong> – positive integer</td> </tr> </tbody> </table> <p>Set or return the drawing <em>delay</em> in milliseconds. (This is approximately the time interval between two consecutive canvas updates.) The longer the drawing delay, the slower the animation.</p> <p>Optional argument:</p> <div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="n">screen</span><span class="o">.</span><span class="n">delay</span><span class="p">()</span> <span class="go">10</span> <span class="gp">>>> </span><span class="n">screen</span><span class="o">.</span><span class="n">delay</span><span class="p">(</span><span class="mi">5</span><span class="p">)</span> <span class="gp">>>> </span><span class="n">screen</span><span class="o">.</span><span class="n">delay</span><span class="p">()</span> <span class="go">5</span> </pre></div> </div> </dd></dl> <dl class="function"> <dt> <tt class="descclassname">turtle.</tt><tt class="descname">tracer</tt><big>(</big><em>n=None</em>, <em>delay=None</em><big>)</big></dt> <dd><table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple"> <li><strong>n</strong> – nonnegative integer</li> <li><strong>delay</strong> – nonnegative integer</li> </ul> </td> </tr> </tbody> </table> <p>Turn turtle animation on/off and set delay for update drawings. If <em>n</em> is given, only each n-th regular screen update is really performed. (Can be used to accelerate the drawing of complex graphics.) Second argument sets delay value (see <a class="reference internal" href="#turtle.delay" title="turtle.delay"><tt class="xref py py-func docutils literal"><span class="pre">delay()</span></tt></a>).</p> <div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="n">screen</span><span class="o">.</span><span class="n">tracer</span><span class="p">(</span><span class="mi">8</span><span class="p">,</span> <span class="mi">25</span><span class="p">)</span> <span class="gp">>>> </span><span class="n">dist</span> <span class="o">=</span> <span class="mi">2</span> <span class="gp">>>> </span><span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="mi">200</span><span class="p">):</span> <span class="gp">... </span> <span class="n">fd</span><span class="p">(</span><span class="n">dist</span><span class="p">)</span> <span class="gp">... </span> <span class="n">rt</span><span class="p">(</span><span class="mi">90</span><span class="p">)</span> <span class="gp">... </span> <span class="n">dist</span> <span class="o">+=</span> <span class="mi">2</span> </pre></div> </div> </dd></dl> <dl class="function"> <dt id="turtle.update"> <tt class="descclassname">turtle.</tt><tt class="descname">update</tt><big>(</big><big>)</big><a class="headerlink" href="#turtle.update" title="Permalink to this definition">¶</a></dt> <dd><p>Perform a TurtleScreen update. To be used when tracer is turned off.</p> </dd></dl> <p>See also the RawTurtle/Turtle method <a class="reference internal" href="#turtle.speed" title="turtle.speed"><tt class="xref py py-func docutils literal"><span class="pre">speed()</span></tt></a>.</p> </div> <div class="section" id="using-screen-events"> <h3>24.5.4.3. Using screen events<a class="headerlink" href="#using-screen-events" title="Permalink to this headline">¶</a></h3> <dl class="function"> <dt id="turtle.listen"> <tt class="descclassname">turtle.</tt><tt class="descname">listen</tt><big>(</big><em>xdummy=None</em>, <em>ydummy=None</em><big>)</big><a class="headerlink" href="#turtle.listen" title="Permalink to this definition">¶</a></dt> <dd><p>Set focus on TurtleScreen (in order to collect key-events). Dummy arguments are provided in order to be able to pass <a class="reference internal" href="#turtle.listen" title="turtle.listen"><tt class="xref py py-func docutils literal"><span class="pre">listen()</span></tt></a> to the onclick method.</p> </dd></dl> <dl class="function"> <dt id="turtle.onkey"> <tt class="descclassname">turtle.</tt><tt class="descname">onkey</tt><big>(</big><em>fun</em>, <em>key</em><big>)</big><a class="headerlink" href="#turtle.onkey" title="Permalink to this definition">¶</a></dt> <dd><table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple"> <li><strong>fun</strong> – a function with no arguments or <tt class="docutils literal"><span class="pre">None</span></tt></li> <li><strong>key</strong> – a string: key (e.g. “a”) or key-symbol (e.g. “space”)</li> </ul> </td> </tr> </tbody> </table> <p>Bind <em>fun</em> to key-release event of key. If <em>fun</em> is <tt class="docutils literal"><span class="pre">None</span></tt>, event bindings are removed. Remark: in order to be able to register key-events, TurtleScreen must have the focus. (See method <a class="reference internal" href="#turtle.listen" title="turtle.listen"><tt class="xref py py-func docutils literal"><span class="pre">listen()</span></tt></a>.)</p> <div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="k">def</span> <span class="nf">f</span><span class="p">():</span> <span class="gp">... </span> <span class="n">fd</span><span class="p">(</span><span class="mi">50</span><span class="p">)</span> <span class="gp">... </span> <span class="n">lt</span><span class="p">(</span><span class="mi">60</span><span class="p">)</span> <span class="gp">...</span> <span class="gp">>>> </span><span class="n">screen</span><span class="o">.</span><span class="n">onkey</span><span class="p">(</span><span class="n">f</span><span class="p">,</span> <span class="s">"Up"</span><span class="p">)</span> <span class="gp">>>> </span><span class="n">screen</span><span class="o">.</span><span class="n">listen</span><span class="p">()</span> </pre></div> </div> </dd></dl> <dl class="function"> <dt> <tt class="descclassname">turtle.</tt><tt class="descname">onclick</tt><big>(</big><em>fun</em>, <em>btn=1</em>, <em>add=None</em><big>)</big></dt> <dt id="turtle.onscreenclick"> <tt class="descclassname">turtle.</tt><tt class="descname">onscreenclick</tt><big>(</big><em>fun</em>, <em>btn=1</em>, <em>add=None</em><big>)</big><a class="headerlink" href="#turtle.onscreenclick" title="Permalink to this definition">¶</a></dt> <dd><table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple"> <li><strong>fun</strong> – a function with two arguments which will be called with the coordinates of the clicked point on the canvas</li> <li><strong>num</strong> – number of the mouse-button, defaults to 1 (left mouse button)</li> <li><strong>add</strong> – <tt class="docutils literal"><span class="pre">True</span></tt> or <tt class="docutils literal"><span class="pre">False</span></tt> – if <tt class="docutils literal"><span class="pre">True</span></tt>, a new binding will be added, otherwise it will replace a former binding</li> </ul> </td> </tr> </tbody> </table> <p>Bind <em>fun</em> to mouse-click events on this screen. If <em>fun</em> is <tt class="docutils literal"><span class="pre">None</span></tt>, existing bindings are removed.</p> <p>Example for a TurtleScreen instance named <tt class="docutils literal"><span class="pre">screen</span></tt> and a Turtle instance named turtle:</p> <div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="n">screen</span><span class="o">.</span><span class="n">onclick</span><span class="p">(</span><span class="n">turtle</span><span class="o">.</span><span class="n">goto</span><span class="p">)</span> <span class="c"># Subsequently clicking into the TurtleScreen will</span> <span class="gp">>>> </span> <span class="c"># make the turtle move to the clicked point.</span> <span class="gp">>>> </span><span class="n">screen</span><span class="o">.</span><span class="n">onclick</span><span class="p">(</span><span class="bp">None</span><span class="p">)</span> <span class="c"># remove event binding again</span> </pre></div> </div> <div class="admonition note"> <p class="first admonition-title">Note</p> <p class="last">This TurtleScreen method is available as a global function only under the name <tt class="docutils literal"><span class="pre">onscreenclick</span></tt>. The global function <tt class="docutils literal"><span class="pre">onclick</span></tt> is another one derived from the Turtle method <tt class="docutils literal"><span class="pre">onclick</span></tt>.</p> </div> </dd></dl> <dl class="function"> <dt id="turtle.ontimer"> <tt class="descclassname">turtle.</tt><tt class="descname">ontimer</tt><big>(</big><em>fun</em>, <em>t=0</em><big>)</big><a class="headerlink" href="#turtle.ontimer" title="Permalink to this definition">¶</a></dt> <dd><table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple"> <li><strong>fun</strong> – a function with no arguments</li> <li><strong>t</strong> – a number >= 0</li> </ul> </td> </tr> </tbody> </table> <p>Install a timer that calls <em>fun</em> after <em>t</em> milliseconds.</p> <div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="n">running</span> <span class="o">=</span> <span class="bp">True</span> <span class="gp">>>> </span><span class="k">def</span> <span class="nf">f</span><span class="p">():</span> <span class="gp">... </span> <span class="k">if</span> <span class="n">running</span><span class="p">:</span> <span class="gp">... </span> <span class="n">fd</span><span class="p">(</span><span class="mi">50</span><span class="p">)</span> <span class="gp">... </span> <span class="n">lt</span><span class="p">(</span><span class="mi">60</span><span class="p">)</span> <span class="gp">... </span> <span class="n">screen</span><span class="o">.</span><span class="n">ontimer</span><span class="p">(</span><span class="n">f</span><span class="p">,</span> <span class="mi">250</span><span class="p">)</span> <span class="gp">>>> </span><span class="n">f</span><span class="p">()</span> <span class="c">### makes the turtle march around</span> <span class="gp">>>> </span><span class="n">running</span> <span class="o">=</span> <span class="bp">False</span> </pre></div> </div> </dd></dl> </div> <div class="section" id="settings-and-special-methods"> <h3>24.5.4.4. Settings and special methods<a class="headerlink" href="#settings-and-special-methods" title="Permalink to this headline">¶</a></h3> <dl class="function"> <dt id="turtle.mode"> <tt class="descclassname">turtle.</tt><tt class="descname">mode</tt><big>(</big><em>mode=None</em><big>)</big><a class="headerlink" href="#turtle.mode" title="Permalink to this definition">¶</a></dt> <dd><table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>mode</strong> – one of the strings “standard”, “logo” or “world”</td> </tr> </tbody> </table> <p>Set turtle mode (“standard”, “logo” or “world”) and perform reset. If mode is not given, current mode is returned.</p> <p>Mode “standard” is compatible with old <a class="reference internal" href="#module-turtle" title="turtle: Turtle graphics for Tk"><tt class="xref py py-mod docutils literal"><span class="pre">turtle</span></tt></a>. Mode “logo” is compatible with most Logo turtle graphics. Mode “world” uses user-defined “world coordinates”. <strong>Attention</strong>: in this mode angles appear distorted if <tt class="docutils literal"><span class="pre">x/y</span></tt> unit-ratio doesn’t equal 1.</p> <table border="1" class="docutils"> <colgroup> <col width="21%" /> <col width="45%" /> <col width="34%" /> </colgroup> <thead valign="bottom"> <tr class="row-odd"><th class="head">Mode</th> <th class="head">Initial turtle heading</th> <th class="head">positive angles</th> </tr> </thead> <tbody valign="top"> <tr class="row-even"><td>“standard”</td> <td>to the right (east)</td> <td>counterclockwise</td> </tr> <tr class="row-odd"><td>“logo”</td> <td>upward (north)</td> <td>clockwise</td> </tr> </tbody> </table> <div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="n">mode</span><span class="p">(</span><span class="s">"logo"</span><span class="p">)</span> <span class="c"># resets turtle heading to north</span> <span class="gp">>>> </span><span class="n">mode</span><span class="p">()</span> <span class="go">'logo'</span> </pre></div> </div> </dd></dl> <dl class="function"> <dt id="turtle.colormode"> <tt class="descclassname">turtle.</tt><tt class="descname">colormode</tt><big>(</big><em>cmode=None</em><big>)</big><a class="headerlink" href="#turtle.colormode" title="Permalink to this definition">¶</a></dt> <dd><table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>cmode</strong> – one of the values 1.0 or 255</td> </tr> </tbody> </table> <p>Return the colormode or set it to 1.0 or 255. Subsequently <em>r</em>, <em>g</em>, <em>b</em> values of color triples have to be in the range 0..<em>cmode</em>.</p> <div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="n">screen</span><span class="o">.</span><span class="n">colormode</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span> <span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">pencolor</span><span class="p">(</span><span class="mi">240</span><span class="p">,</span> <span class="mi">160</span><span class="p">,</span> <span class="mi">80</span><span class="p">)</span> <span class="gt">Traceback (most recent call last):</span> <span class="o">...</span> <span class="gr">TurtleGraphicsError: bad color sequence</span>: <span class="n">(240, 160, 80)</span> <span class="gp">>>> </span><span class="n">screen</span><span class="o">.</span><span class="n">colormode</span><span class="p">()</span> <span class="go">1.0</span> <span class="gp">>>> </span><span class="n">screen</span><span class="o">.</span><span class="n">colormode</span><span class="p">(</span><span class="mi">255</span><span class="p">)</span> <span class="gp">>>> </span><span class="n">screen</span><span class="o">.</span><span class="n">colormode</span><span class="p">()</span> <span class="go">255</span> <span class="gp">>>> </span><span class="n">turtle</span><span class="o">.</span><span class="n">pencolor</span><span class="p">(</span><span class="mi">240</span><span class="p">,</span><span class="mi">160</span><span class="p">,</span><span class="mi">80</span><span class="p">)</span> </pre></div> </div> </dd></dl> <dl class="function"> <dt id="turtle.getcanvas"> <tt class="descclassname">turtle.</tt><tt class="descname">getcanvas</tt><big>(</big><big>)</big><a class="headerlink" href="#turtle.getcanvas" title="Permalink to this definition">¶</a></dt> <dd><p>Return the Canvas of this TurtleScreen. Useful for insiders who know what to do with a Tkinter Canvas.</p> <div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="n">cv</span> <span class="o">=</span> <span class="n">screen</span><span class="o">.</span><span class="n">getcanvas</span><span class="p">()</span> <span class="gp">>>> </span><span class="n">cv</span> <span class="go"><turtle.ScrolledCanvas instance at 0x...></span> </pre></div> </div> </dd></dl> <dl class="function"> <dt id="turtle.getshapes"> <tt class="descclassname">turtle.</tt><tt class="descname">getshapes</tt><big>(</big><big>)</big><a class="headerlink" href="#turtle.getshapes" title="Permalink to this definition">¶</a></dt> <dd><p>Return a list of names of all currently available turtle shapes.</p> <div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="n">screen</span><span class="o">.</span><span class="n">getshapes</span><span class="p">()</span> <span class="go">['arrow', 'blank', 'circle', ..., 'turtle']</span> </pre></div> </div> </dd></dl> <dl class="function"> <dt id="turtle.register_shape"> <tt class="descclassname">turtle.</tt><tt class="descname">register_shape</tt><big>(</big><em>name</em>, <em>shape=None</em><big>)</big><a class="headerlink" href="#turtle.register_shape" title="Permalink to this definition">¶</a></dt> <dt id="turtle.addshape"> <tt class="descclassname">turtle.</tt><tt class="descname">addshape</tt><big>(</big><em>name</em>, <em>shape=None</em><big>)</big><a class="headerlink" href="#turtle.addshape" title="Permalink to this definition">¶</a></dt> <dd><p>There are three different ways to call this function:</p> <ol class="arabic"> <li><p class="first"><em>name</em> is the name of a gif-file and <em>shape</em> is <tt class="docutils literal"><span class="pre">None</span></tt>: Install the corresponding image shape.</p> <div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="n">screen</span><span class="o">.</span><span class="n">register_shape</span><span class="p">(</span><span class="s">"turtle.gif"</span><span class="p">)</span> </pre></div> </div> <div class="admonition note"> <p class="first admonition-title">Note</p> <p class="last">Image shapes <em>do not</em> rotate when turning the turtle, so they do not display the heading of the turtle!</p> </div> </li> <li><p class="first"><em>name</em> is an arbitrary string and <em>shape</em> is a tuple of pairs of coordinates: Install the corresponding polygon shape.</p> <div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="n">screen</span><span class="o">.</span><span class="n">register_shape</span><span class="p">(</span><span class="s">"triangle"</span><span class="p">,</span> <span class="p">((</span><span class="mi">5</span><span class="p">,</span><span class="o">-</span><span class="mi">3</span><span class="p">),</span> <span class="p">(</span><span class="mi">0</span><span class="p">,</span><span class="mi">5</span><span class="p">),</span> <span class="p">(</span><span class="o">-</span><span class="mi">5</span><span class="p">,</span><span class="o">-</span><span class="mi">3</span><span class="p">)))</span> </pre></div> </div> </li> <li><p class="first"><em>name</em> is an arbitrary string and shape is a (compound) <a class="reference internal" href="#turtle.Shape" title="turtle.Shape"><tt class="xref py py-class docutils literal"><span class="pre">Shape</span></tt></a> object: Install the corresponding compound shape.</p> </li> </ol> <p>Add a turtle shape to TurtleScreen’s shapelist. Only thusly registered shapes can be used by issuing the command <tt class="docutils literal"><span class="pre">shape(shapename)</span></tt>.</p> </dd></dl> <dl class="function"> <dt id="turtle.turtles"> <tt class="descclassname">turtle.</tt><tt class="descname">turtles</tt><big>(</big><big>)</big><a class="headerlink" href="#turtle.turtles" title="Permalink to this definition">¶</a></dt> <dd><p>Return the list of turtles on the screen.</p> <div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="k">for</span> <span class="n">turtle</span> <span class="ow">in</span> <span class="n">screen</span><span class="o">.</span><span class="n">turtles</span><span class="p">():</span> <span class="gp">... </span> <span class="n">turtle</span><span class="o">.</span><span class="n">color</span><span class="p">(</span><span class="s">"red"</span><span class="p">)</span> </pre></div> </div> </dd></dl> <dl class="function"> <dt> <tt class="descclassname">turtle.</tt><tt class="descname">window_height</tt><big>(</big><big>)</big></dt> <dd><p>Return the height of the turtle window.</p> <div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="n">screen</span><span class="o">.</span><span class="n">window_height</span><span class="p">()</span> <span class="go">480</span> </pre></div> </div> </dd></dl> <dl class="function"> <dt> <tt class="descclassname">turtle.</tt><tt class="descname">window_width</tt><big>(</big><big>)</big></dt> <dd><p>Return the width of the turtle window.</p> <div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="n">screen</span><span class="o">.</span><span class="n">window_width</span><span class="p">()</span> <span class="go">640</span> </pre></div> </div> </dd></dl> </div> <div class="section" id="methods-specific-to-screen-not-inherited-from-turtlescreen"> <span id="screenspecific"></span><h3>24.5.4.5. Methods specific to Screen, not inherited from TurtleScreen<a class="headerlink" href="#methods-specific-to-screen-not-inherited-from-turtlescreen" title="Permalink to this headline">¶</a></h3> <dl class="function"> <dt id="turtle.bye"> <tt class="descclassname">turtle.</tt><tt class="descname">bye</tt><big>(</big><big>)</big><a class="headerlink" href="#turtle.bye" title="Permalink to this definition">¶</a></dt> <dd><p>Shut the turtlegraphics window.</p> </dd></dl> <dl class="function"> <dt id="turtle.exitonclick"> <tt class="descclassname">turtle.</tt><tt class="descname">exitonclick</tt><big>(</big><big>)</big><a class="headerlink" href="#turtle.exitonclick" title="Permalink to this definition">¶</a></dt> <dd><p>Bind bye() method to mouse clicks on the Screen.</p> <p>If the value “using_IDLE” in the configuration dictionary is <tt class="docutils literal"><span class="pre">False</span></tt> (default value), also enter mainloop. Remark: If IDLE with the <tt class="docutils literal"><span class="pre">-n</span></tt> switch (no subprocess) is used, this value should be set to <tt class="docutils literal"><span class="pre">True</span></tt> in <tt class="file docutils literal"><span class="pre">turtle.cfg</span></tt>. In this case IDLE’s own mainloop is active also for the client script.</p> </dd></dl> <dl class="function"> <dt id="turtle.setup"> <tt class="descclassname">turtle.</tt><tt class="descname">setup</tt><big>(</big><em>width=_CFG["width"], height=_CFG["height"], startx=_CFG["leftright"], starty=_CFG["topbottom"]</em><big>)</big><a class="headerlink" href="#turtle.setup" title="Permalink to this definition">¶</a></dt> <dd><p>Set the size and position of the main window. Default values of arguments are stored in the configuration dictionary and can be changed via a <tt class="file docutils literal"><span class="pre">turtle.cfg</span></tt> file.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple"> <li><strong>width</strong> – if an integer, a size in pixels, if a float, a fraction of the screen; default is 50% of screen</li> <li><strong>height</strong> – if an integer, the height in pixels, if a float, a fraction of the screen; default is 75% of screen</li> <li><strong>startx</strong> – if positive, starting position in pixels from the left edge of the screen, if negative from the right edge, if None, center window horizontally</li> <li><strong>startx</strong> – if positive, starting position in pixels from the top edge of the screen, if negative from the bottom edge, if None, center window vertically</li> </ul> </td> </tr> </tbody> </table> <div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="n">screen</span><span class="o">.</span><span class="n">setup</span> <span class="p">(</span><span class="n">width</span><span class="o">=</span><span class="mi">200</span><span class="p">,</span> <span class="n">height</span><span class="o">=</span><span class="mi">200</span><span class="p">,</span> <span class="n">startx</span><span class="o">=</span><span class="mi">0</span><span class="p">,</span> <span class="n">starty</span><span class="o">=</span><span class="mi">0</span><span class="p">)</span> <span class="gp">>>> </span> <span class="c"># sets window to 200x200 pixels, in upper left of screen</span> <span class="gp">>>> </span><span class="n">screen</span><span class="o">.</span><span class="n">setup</span><span class="p">(</span><span class="n">width</span><span class="o">=.</span><span class="mi">75</span><span class="p">,</span> <span class="n">height</span><span class="o">=</span><span class="mf">0.5</span><span class="p">,</span> <span class="n">startx</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">starty</span><span class="o">=</span><span class="bp">None</span><span class="p">)</span> <span class="gp">>>> </span> <span class="c"># sets window to 75% of screen by 50% of screen and centers</span> </pre></div> </div> </dd></dl> <dl class="function"> <dt id="turtle.title"> <tt class="descclassname">turtle.</tt><tt class="descname">title</tt><big>(</big><em>titlestring</em><big>)</big><a class="headerlink" href="#turtle.title" title="Permalink to this definition">¶</a></dt> <dd><table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>titlestring</strong> – a string that is shown in the titlebar of the turtle graphics window</td> </tr> </tbody> </table> <p>Set title of turtle window to <em>titlestring</em>.</p> <div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="n">screen</span><span class="o">.</span><span class="n">title</span><span class="p">(</span><span class="s">"Welcome to the turtle zoo!"</span><span class="p">)</span> </pre></div> </div> </dd></dl> </div> </div> <div class="section" id="the-public-classes-of-the-module-turtle"> <h2>24.5.5. The public classes of the module <a class="reference internal" href="#module-turtle" title="turtle: Turtle graphics for Tk"><tt class="xref py py-mod docutils literal"><span class="pre">turtle</span></tt></a><a class="headerlink" href="#the-public-classes-of-the-module-turtle" title="Permalink to this headline">¶</a></h2> <dl class="class"> <dt id="turtle.RawTurtle"> <em class="property">class </em><tt class="descclassname">turtle.</tt><tt class="descname">RawTurtle</tt><big>(</big><em>canvas</em><big>)</big><a class="headerlink" href="#turtle.RawTurtle" title="Permalink to this definition">¶</a></dt> <dt id="turtle.RawPen"> <em class="property">class </em><tt class="descclassname">turtle.</tt><tt class="descname">RawPen</tt><big>(</big><em>canvas</em><big>)</big><a class="headerlink" href="#turtle.RawPen" title="Permalink to this definition">¶</a></dt> <dd><table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>canvas</strong> – a <tt class="xref py py-class docutils literal"><span class="pre">Tkinter.Canvas</span></tt>, a <a class="reference internal" href="#turtle.ScrolledCanvas" title="turtle.ScrolledCanvas"><tt class="xref py py-class docutils literal"><span class="pre">ScrolledCanvas</span></tt></a> or a <a class="reference internal" href="#turtle.TurtleScreen" title="turtle.TurtleScreen"><tt class="xref py py-class docutils literal"><span class="pre">TurtleScreen</span></tt></a></td> </tr> </tbody> </table> <p>Create a turtle. The turtle has all methods described above as “methods of Turtle/RawTurtle”.</p> </dd></dl> <dl class="class"> <dt id="turtle.Turtle"> <em class="property">class </em><tt class="descclassname">turtle.</tt><tt class="descname">Turtle</tt><a class="headerlink" href="#turtle.Turtle" title="Permalink to this definition">¶</a></dt> <dd><p>Subclass of RawTurtle, has the same interface but draws on a default <a class="reference internal" href="#turtle.Screen" title="turtle.Screen"><tt class="xref py py-class docutils literal"><span class="pre">Screen</span></tt></a> object created automatically when needed for the first time.</p> </dd></dl> <dl class="class"> <dt id="turtle.TurtleScreen"> <em class="property">class </em><tt class="descclassname">turtle.</tt><tt class="descname">TurtleScreen</tt><big>(</big><em>cv</em><big>)</big><a class="headerlink" href="#turtle.TurtleScreen" title="Permalink to this definition">¶</a></dt> <dd><table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>cv</strong> – a <tt class="xref py py-class docutils literal"><span class="pre">Tkinter.Canvas</span></tt></td> </tr> </tbody> </table> <p>Provides screen oriented methods like <tt class="xref py py-func docutils literal"><span class="pre">setbg()</span></tt> etc. that are described above.</p> </dd></dl> <dl class="class"> <dt id="turtle.Screen"> <em class="property">class </em><tt class="descclassname">turtle.</tt><tt class="descname">Screen</tt><a class="headerlink" href="#turtle.Screen" title="Permalink to this definition">¶</a></dt> <dd><p>Subclass of TurtleScreen, with <a class="reference internal" href="#screenspecific"><em>four methods added</em></a>.</p> </dd></dl> <dl class="class"> <dt id="turtle.ScrolledCanvas"> <em class="property">class </em><tt class="descclassname">turtle.</tt><tt class="descname">ScrolledCanvas</tt><big>(</big><em>master</em><big>)</big><a class="headerlink" href="#turtle.ScrolledCanvas" title="Permalink to this definition">¶</a></dt> <dd><table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>master</strong> – some Tkinter widget to contain the ScrolledCanvas, i.e. a Tkinter-canvas with scrollbars added</td> </tr> </tbody> </table> <p>Used by class Screen, which thus automatically provides a ScrolledCanvas as playground for the turtles.</p> </dd></dl> <dl class="class"> <dt id="turtle.Shape"> <em class="property">class </em><tt class="descclassname">turtle.</tt><tt class="descname">Shape</tt><big>(</big><em>type_</em>, <em>data</em><big>)</big><a class="headerlink" href="#turtle.Shape" title="Permalink to this definition">¶</a></dt> <dd><table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>type_</strong> – one of the strings “polygon”, “image”, “compound”</td> </tr> </tbody> </table> <p>Data structure modeling shapes. The pair <tt class="docutils literal"><span class="pre">(type_,</span> <span class="pre">data)</span></tt> must follow this specification:</p> <table border="1" class="docutils"> <colgroup> <col width="16%" /> <col width="84%" /> </colgroup> <thead valign="bottom"> <tr class="row-odd"><th class="head"><em>type_</em></th> <th class="head"><em>data</em></th> </tr> </thead> <tbody valign="top"> <tr class="row-even"><td>“polygon”</td> <td>a polygon-tuple, i.e. a tuple of pairs of coordinates</td> </tr> <tr class="row-odd"><td>“image”</td> <td>an image (in this form only used internally!)</td> </tr> <tr class="row-even"><td>“compound”</td> <td><tt class="docutils literal"><span class="pre">None</span></tt> (a compound shape has to be constructed using the <a class="reference internal" href="#turtle.Shape.addcomponent" title="turtle.Shape.addcomponent"><tt class="xref py py-meth docutils literal"><span class="pre">addcomponent()</span></tt></a> method)</td> </tr> </tbody> </table> <dl class="method"> <dt id="turtle.Shape.addcomponent"> <tt class="descname">addcomponent</tt><big>(</big><em>poly</em>, <em>fill</em>, <em>outline=None</em><big>)</big><a class="headerlink" href="#turtle.Shape.addcomponent" title="Permalink to this definition">¶</a></dt> <dd><table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple"> <li><strong>poly</strong> – a polygon, i.e. a tuple of pairs of numbers</li> <li><strong>fill</strong> – a color the <em>poly</em> will be filled with</li> <li><strong>outline</strong> – a color for the poly’s outline (if given)</li> </ul> </td> </tr> </tbody> </table> <p>Example:</p> <div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="n">poly</span> <span class="o">=</span> <span class="p">((</span><span class="mi">0</span><span class="p">,</span><span class="mi">0</span><span class="p">),(</span><span class="mi">10</span><span class="p">,</span><span class="o">-</span><span class="mi">5</span><span class="p">),(</span><span class="mi">0</span><span class="p">,</span><span class="mi">10</span><span class="p">),(</span><span class="o">-</span><span class="mi">10</span><span class="p">,</span><span class="o">-</span><span class="mi">5</span><span class="p">))</span> <span class="gp">>>> </span><span class="n">s</span> <span class="o">=</span> <span class="n">Shape</span><span class="p">(</span><span class="s">"compound"</span><span class="p">)</span> <span class="gp">>>> </span><span class="n">s</span><span class="o">.</span><span class="n">addcomponent</span><span class="p">(</span><span class="n">poly</span><span class="p">,</span> <span class="s">"red"</span><span class="p">,</span> <span class="s">"blue"</span><span class="p">)</span> <span class="gp">>>> </span><span class="c"># ... add more components and then use register_shape()</span> </pre></div> </div> <p>See <a class="reference internal" href="#compoundshapes"><em>Excursus about the use of compound shapes</em></a>.</p> </dd></dl> </dd></dl> <dl class="class"> <dt id="turtle.Vec2D"> <em class="property">class </em><tt class="descclassname">turtle.</tt><tt class="descname">Vec2D</tt><big>(</big><em>x</em>, <em>y</em><big>)</big><a class="headerlink" href="#turtle.Vec2D" title="Permalink to this definition">¶</a></dt> <dd><p>A two-dimensional vector class, used as a helper class for implementing turtle graphics. May be useful for turtle graphics programs too. Derived from tuple, so a vector is a tuple!</p> <p>Provides (for <em>a</em>, <em>b</em> vectors, <em>k</em> number):</p> <ul class="simple"> <li><tt class="docutils literal"><span class="pre">a</span> <span class="pre">+</span> <span class="pre">b</span></tt> vector addition</li> <li><tt class="docutils literal"><span class="pre">a</span> <span class="pre">-</span> <span class="pre">b</span></tt> vector subtraction</li> <li><tt class="docutils literal"><span class="pre">a</span> <span class="pre">*</span> <span class="pre">b</span></tt> inner product</li> <li><tt class="docutils literal"><span class="pre">k</span> <span class="pre">*</span> <span class="pre">a</span></tt> and <tt class="docutils literal"><span class="pre">a</span> <span class="pre">*</span> <span class="pre">k</span></tt> multiplication with scalar</li> <li><tt class="docutils literal"><span class="pre">abs(a)</span></tt> absolute value of a</li> <li><tt class="docutils literal"><span class="pre">a.rotate(angle)</span></tt> rotation</li> </ul> </dd></dl> </div> <div class="section" id="help-and-configuration"> <h2>24.5.6. Help and configuration<a class="headerlink" href="#help-and-configuration" title="Permalink to this headline">¶</a></h2> <div class="section" id="how-to-use-help"> <h3>24.5.6.1. How to use help<a class="headerlink" href="#how-to-use-help" title="Permalink to this headline">¶</a></h3> <p>The public methods of the Screen and Turtle classes are documented extensively via docstrings. So these can be used as online-help via the Python help facilities:</p> <ul> <li><p class="first">When using IDLE, tooltips show the signatures and first lines of the docstrings of typed in function-/method calls.</p> </li> <li><p class="first">Calling <a class="reference internal" href="functions.html#help" title="help"><tt class="xref py py-func docutils literal"><span class="pre">help()</span></tt></a> on methods or functions displays the docstrings:</p> <div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="n">help</span><span class="p">(</span><span class="n">Screen</span><span class="o">.</span><span class="n">bgcolor</span><span class="p">)</span> <span class="go">Help on method bgcolor in module turtle:</span> <span class="go">bgcolor(self, *args) unbound turtle.Screen method</span> <span class="go"> Set or return backgroundcolor of the TurtleScreen.</span> <span class="go"> Arguments (if given): a color string or three numbers</span> <span class="go"> in the range 0..colormode or a 3-tuple of such numbers.</span> <span class="go"> >>> screen.bgcolor("orange")</span> <span class="go"> >>> screen.bgcolor()</span> <span class="go"> "orange"</span> <span class="go"> >>> screen.bgcolor(0.5,0,0.5)</span> <span class="go"> >>> screen.bgcolor()</span> <span class="go"> "#800080"</span> <span class="gp">>>> </span><span class="n">help</span><span class="p">(</span><span class="n">Turtle</span><span class="o">.</span><span class="n">penup</span><span class="p">)</span> <span class="go">Help on method penup in module turtle:</span> <span class="go">penup(self) unbound turtle.Turtle method</span> <span class="go"> Pull the pen up -- no drawing when moving.</span> <span class="go"> Aliases: penup | pu | up</span> <span class="go"> No argument</span> <span class="go"> >>> turtle.penup()</span> </pre></div> </div> </li> <li><p class="first">The docstrings of the functions which are derived from methods have a modified form:</p> <div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="n">help</span><span class="p">(</span><span class="n">bgcolor</span><span class="p">)</span> <span class="go">Help on function bgcolor in module turtle:</span> <span class="go">bgcolor(*args)</span> <span class="go"> Set or return backgroundcolor of the TurtleScreen.</span> <span class="go"> Arguments (if given): a color string or three numbers</span> <span class="go"> in the range 0..colormode or a 3-tuple of such numbers.</span> <span class="go"> Example::</span> <span class="go"> >>> bgcolor("orange")</span> <span class="go"> >>> bgcolor()</span> <span class="go"> "orange"</span> <span class="go"> >>> bgcolor(0.5,0,0.5)</span> <span class="go"> >>> bgcolor()</span> <span class="go"> "#800080"</span> <span class="gp">>>> </span><span class="n">help</span><span class="p">(</span><span class="n">penup</span><span class="p">)</span> <span class="go">Help on function penup in module turtle:</span> <span class="go">penup()</span> <span class="go"> Pull the pen up -- no drawing when moving.</span> <span class="go"> Aliases: penup | pu | up</span> <span class="go"> No argument</span> <span class="go"> Example:</span> <span class="go"> >>> penup()</span> </pre></div> </div> </li> </ul> <p>These modified docstrings are created automatically together with the function definitions that are derived from the methods at import time.</p> </div> <div class="section" id="translation-of-docstrings-into-different-languages"> <h3>24.5.6.2. Translation of docstrings into different languages<a class="headerlink" href="#translation-of-docstrings-into-different-languages" title="Permalink to this headline">¶</a></h3> <p>There is a utility to create a dictionary the keys of which are the method names and the values of which are the docstrings of the public methods of the classes Screen and Turtle.</p> <dl class="function"> <dt id="turtle.write_docstringdict"> <tt class="descclassname">turtle.</tt><tt class="descname">write_docstringdict</tt><big>(</big><em>filename="turtle_docstringdict"</em><big>)</big><a class="headerlink" href="#turtle.write_docstringdict" title="Permalink to this definition">¶</a></dt> <dd><table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>filename</strong> – a string, used as filename</td> </tr> </tbody> </table> <p>Create and write docstring-dictionary to a Python script with the given filename. This function has to be called explicitly (it is not used by the turtle graphics classes). The docstring dictionary will be written to the Python script <tt class="file docutils literal"><em><span class="pre">filename</span></em><span class="pre">.py</span></tt>. It is intended to serve as a template for translation of the docstrings into different languages.</p> </dd></dl> <p>If you (or your students) want to use <a class="reference internal" href="#module-turtle" title="turtle: Turtle graphics for Tk"><tt class="xref py py-mod docutils literal"><span class="pre">turtle</span></tt></a> with online help in your native language, you have to translate the docstrings and save the resulting file as e.g. <tt class="file docutils literal"><span class="pre">turtle_docstringdict_german.py</span></tt>.</p> <p>If you have an appropriate entry in your <tt class="file docutils literal"><span class="pre">turtle.cfg</span></tt> file this dictionary will be read in at import time and will replace the original English docstrings.</p> <p>At the time of this writing there are docstring dictionaries in German and in Italian. (Requests please to <a class="reference external" href="mailto:glingl%40aon.at">glingl<span>@</span>aon<span>.</span>at</a>.)</p> </div> <div class="section" id="how-to-configure-screen-and-turtles"> <h3>24.5.6.3. How to configure Screen and Turtles<a class="headerlink" href="#how-to-configure-screen-and-turtles" title="Permalink to this headline">¶</a></h3> <p>The built-in default configuration mimics the appearance and behaviour of the old turtle module in order to retain best possible compatibility with it.</p> <p>If you want to use a different configuration which better reflects the features of this module or which better fits to your needs, e.g. for use in a classroom, you can prepare a configuration file <tt class="docutils literal"><span class="pre">turtle.cfg</span></tt> which will be read at import time and modify the configuration according to its settings.</p> <p>The built in configuration would correspond to the following turtle.cfg:</p> <div class="highlight-python"><pre>width = 0.5 height = 0.75 leftright = None topbottom = None canvwidth = 400 canvheight = 300 mode = standard colormode = 1.0 delay = 10 undobuffersize = 1000 shape = classic pencolor = black fillcolor = black resizemode = noresize visible = True language = english exampleturtle = turtle examplescreen = screen title = Python Turtle Graphics using_IDLE = False</pre> </div> <p>Short explanation of selected entries:</p> <ul class="simple"> <li>The first four lines correspond to the arguments of the <tt class="xref py py-meth docutils literal"><span class="pre">Screen.setup()</span></tt> method.</li> <li>Line 5 and 6 correspond to the arguments of the method <tt class="xref py py-meth docutils literal"><span class="pre">Screen.screensize()</span></tt>.</li> <li><em>shape</em> can be any of the built-in shapes, e.g: arrow, turtle, etc. For more info try <tt class="docutils literal"><span class="pre">help(shape)</span></tt>.</li> <li>If you want to use no fillcolor (i.e. make the turtle transparent), you have to write <tt class="docutils literal"><span class="pre">fillcolor</span> <span class="pre">=</span> <span class="pre">""</span></tt> (but all nonempty strings must not have quotes in the cfg-file).</li> <li>If you want to reflect the turtle its state, you have to use <tt class="docutils literal"><span class="pre">resizemode</span> <span class="pre">=</span> <span class="pre">auto</span></tt>.</li> <li>If you set e.g. <tt class="docutils literal"><span class="pre">language</span> <span class="pre">=</span> <span class="pre">italian</span></tt> the docstringdict <tt class="file docutils literal"><span class="pre">turtle_docstringdict_italian.py</span></tt> will be loaded at import time (if present on the import path, e.g. in the same directory as <a class="reference internal" href="#module-turtle" title="turtle: Turtle graphics for Tk"><tt class="xref py py-mod docutils literal"><span class="pre">turtle</span></tt></a>.</li> <li>The entries <em>exampleturtle</em> and <em>examplescreen</em> define the names of these objects as they occur in the docstrings. The transformation of method-docstrings to function-docstrings will delete these names from the docstrings.</li> <li><em>using_IDLE</em>: Set this to <tt class="docutils literal"><span class="pre">True</span></tt> if you regularly work with IDLE and its -n switch (“no subprocess”). This will prevent <a class="reference internal" href="#turtle.exitonclick" title="turtle.exitonclick"><tt class="xref py py-func docutils literal"><span class="pre">exitonclick()</span></tt></a> to enter the mainloop.</li> </ul> <p>There can be a <tt class="file docutils literal"><span class="pre">turtle.cfg</span></tt> file in the directory where <a class="reference internal" href="#module-turtle" title="turtle: Turtle graphics for Tk"><tt class="xref py py-mod docutils literal"><span class="pre">turtle</span></tt></a> is stored and an additional one in the current working directory. The latter will override the settings of the first one.</p> <p>The <tt class="file docutils literal"><span class="pre">Demo/turtle</span></tt> directory contains a <tt class="file docutils literal"><span class="pre">turtle.cfg</span></tt> file. You can study it as an example and see its effects when running the demos (preferably not from within the demo-viewer).</p> </div> </div> <div class="section" id="demo-scripts"> <h2>24.5.7. Demo scripts<a class="headerlink" href="#demo-scripts" title="Permalink to this headline">¶</a></h2> <p>There is a set of demo scripts in the turtledemo directory located in the <tt class="file docutils literal"><span class="pre">Demo/turtle</span></tt> directory in the source distribution.</p> <p>It contains:</p> <ul class="simple"> <li>a set of 15 demo scripts demonstrating different features of the new module <a class="reference internal" href="#module-turtle" title="turtle: Turtle graphics for Tk"><tt class="xref py py-mod docutils literal"><span class="pre">turtle</span></tt></a></li> <li>a demo viewer <tt class="file docutils literal"><span class="pre">turtleDemo.py</span></tt> which can be used to view the sourcecode of the scripts and run them at the same time. 14 of the examples can be accessed via the Examples menu; all of them can also be run standalone.</li> <li>The example <tt class="file docutils literal"><span class="pre">turtledemo_two_canvases.py</span></tt> demonstrates the simultaneous use of two canvases with the turtle module. Therefore it only can be run standalone.</li> <li>There is a <tt class="file docutils literal"><span class="pre">turtle.cfg</span></tt> file in this directory, which also serves as an example for how to write and use such files.</li> </ul> <p>The demoscripts are:</p> <table border="1" class="docutils"> <colgroup> <col width="23%" /> <col width="43%" /> <col width="33%" /> </colgroup> <thead valign="bottom"> <tr class="row-odd"><th class="head">Name</th> <th class="head">Description</th> <th class="head">Features</th> </tr> </thead> <tbody valign="top"> <tr class="row-even"><td>bytedesign</td> <td>complex classical turtlegraphics pattern</td> <td><a class="reference internal" href="#turtle.tracer" title="turtle.tracer"><tt class="xref py py-func docutils literal"><span class="pre">tracer()</span></tt></a>, delay, <a class="reference internal" href="#turtle.update" title="turtle.update"><tt class="xref py py-func docutils literal"><span class="pre">update()</span></tt></a></td> </tr> <tr class="row-odd"><td>chaos</td> <td>graphs Verhulst dynamics, shows that computer’s computations can generate results sometimes against the common sense expectations</td> <td>world coordinates</td> </tr> <tr class="row-even"><td>clock</td> <td>analog clock showing time of your computer</td> <td>turtles as clock’s hands, ontimer</td> </tr> <tr class="row-odd"><td>colormixer</td> <td>experiment with r, g, b</td> <td><a class="reference internal" href="#turtle.ondrag" title="turtle.ondrag"><tt class="xref py py-func docutils literal"><span class="pre">ondrag()</span></tt></a></td> </tr> <tr class="row-even"><td>fractalcurves</td> <td>Hilbert & Koch curves</td> <td>recursion</td> </tr> <tr class="row-odd"><td>lindenmayer</td> <td>ethnomathematics (indian kolams)</td> <td>L-System</td> </tr> <tr class="row-even"><td>minimal_hanoi</td> <td>Towers of Hanoi</td> <td>Rectangular Turtles as Hanoi discs (shape, shapesize)</td> </tr> <tr class="row-odd"><td>paint</td> <td>super minimalistic drawing program</td> <td><a class="reference internal" href="#turtle.onclick" title="turtle.onclick"><tt class="xref py py-func docutils literal"><span class="pre">onclick()</span></tt></a></td> </tr> <tr class="row-even"><td>peace</td> <td>elementary</td> <td>turtle: appearance and animation</td> </tr> <tr class="row-odd"><td>penrose</td> <td>aperiodic tiling with kites and darts</td> <td><a class="reference internal" href="#turtle.stamp" title="turtle.stamp"><tt class="xref py py-func docutils literal"><span class="pre">stamp()</span></tt></a></td> </tr> <tr class="row-even"><td>planet_and_moon</td> <td>simulation of gravitational system</td> <td>compound shapes, <a class="reference internal" href="#turtle.Vec2D" title="turtle.Vec2D"><tt class="xref py py-class docutils literal"><span class="pre">Vec2D</span></tt></a></td> </tr> <tr class="row-odd"><td>tree</td> <td>a (graphical) breadth first tree (using generators)</td> <td><a class="reference internal" href="#turtle.clone" title="turtle.clone"><tt class="xref py py-func docutils literal"><span class="pre">clone()</span></tt></a></td> </tr> <tr class="row-even"><td>wikipedia</td> <td>a pattern from the wikipedia article on turtle graphics</td> <td><a class="reference internal" href="#turtle.clone" title="turtle.clone"><tt class="xref py py-func docutils literal"><span class="pre">clone()</span></tt></a>, <a class="reference internal" href="#turtle.undo" title="turtle.undo"><tt class="xref py py-func docutils literal"><span class="pre">undo()</span></tt></a></td> </tr> <tr class="row-odd"><td>yingyang</td> <td>another elementary example</td> <td><a class="reference internal" href="#turtle.circle" title="turtle.circle"><tt class="xref py py-func docutils literal"><span class="pre">circle()</span></tt></a></td> </tr> </tbody> </table> <p>Have fun!</p> </div> </div> </div> </div> </div> <div class="sphinxsidebar"> <div class="sphinxsidebarwrapper"> <h3><a href="../contents.html">Table Of Contents</a></h3> <ul> <li><a class="reference internal" href="#">24.5. <tt class="docutils literal"><span class="pre">turtle</span></tt> — Turtle graphics for Tk</a><ul> <li><a class="reference internal" href="#introduction">24.5.1. Introduction</a></li> <li><a class="reference internal" href="#overview-over-available-turtle-and-screen-methods">24.5.2. Overview over available Turtle and Screen methods</a><ul> <li><a class="reference internal" href="#turtle-methods">24.5.2.1. Turtle methods</a></li> <li><a class="reference internal" href="#methods-of-turtlescreen-screen">24.5.2.2. Methods of TurtleScreen/Screen</a></li> </ul> </li> <li><a class="reference internal" href="#methods-of-rawturtle-turtle-and-corresponding-functions">24.5.3. Methods of RawTurtle/Turtle and corresponding functions</a><ul> <li><a class="reference internal" href="#turtle-motion">24.5.3.1. Turtle motion</a></li> <li><a class="reference internal" href="#tell-turtle-s-state">24.5.3.2. Tell Turtle’s state</a></li> <li><a class="reference internal" href="#settings-for-measurement">24.5.3.3. Settings for measurement</a></li> <li><a class="reference internal" href="#pen-control">24.5.3.4. Pen control</a><ul> <li><a class="reference internal" href="#drawing-state">24.5.3.4.1. Drawing state</a></li> <li><a class="reference internal" href="#color-control">24.5.3.4.2. Color control</a></li> <li><a class="reference internal" href="#filling">24.5.3.4.3. Filling</a></li> <li><a class="reference internal" href="#more-drawing-control">24.5.3.4.4. More drawing control</a></li> </ul> </li> <li><a class="reference internal" href="#turtle-state">24.5.3.5. Turtle state</a><ul> <li><a class="reference internal" href="#visibility">24.5.3.5.1. Visibility</a></li> <li><a class="reference internal" href="#appearance">24.5.3.5.2. Appearance</a></li> </ul> </li> <li><a class="reference internal" href="#using-events">24.5.3.6. Using events</a></li> <li><a class="reference internal" href="#special-turtle-methods">24.5.3.7. Special Turtle methods</a></li> <li><a class="reference internal" href="#excursus-about-the-use-of-compound-shapes">24.5.3.8. Excursus about the use of compound shapes</a></li> </ul> </li> <li><a class="reference internal" href="#methods-of-turtlescreen-screen-and-corresponding-functions">24.5.4. Methods of TurtleScreen/Screen and corresponding functions</a><ul> <li><a class="reference internal" href="#window-control">24.5.4.1. Window control</a></li> <li><a class="reference internal" href="#animation-control">24.5.4.2. Animation control</a></li> <li><a class="reference internal" href="#using-screen-events">24.5.4.3. Using screen events</a></li> <li><a class="reference internal" href="#settings-and-special-methods">24.5.4.4. Settings and special methods</a></li> <li><a class="reference internal" href="#methods-specific-to-screen-not-inherited-from-turtlescreen">24.5.4.5. Methods specific to Screen, not inherited from TurtleScreen</a></li> </ul> </li> <li><a class="reference internal" href="#the-public-classes-of-the-module-turtle">24.5.5. The public classes of the module <tt class="docutils literal"><span class="pre">turtle</span></tt></a></li> <li><a class="reference internal" href="#help-and-configuration">24.5.6. Help and configuration</a><ul> <li><a class="reference internal" href="#how-to-use-help">24.5.6.1. How to use help</a></li> <li><a class="reference internal" href="#translation-of-docstrings-into-different-languages">24.5.6.2. Translation of docstrings into different languages</a></li> <li><a class="reference internal" href="#how-to-configure-screen-and-turtles">24.5.6.3. How to configure Screen and Turtles</a></li> </ul> </li> <li><a class="reference internal" href="#demo-scripts">24.5.7. Demo scripts</a></li> </ul> </li> </ul> <h4>Previous topic</h4> <p class="topless"><a href="scrolledtext.html" title="previous chapter">24.4. <tt class="docutils literal"><span class="pre">ScrolledText</span></tt> — Scrolled Text Widget</a></p> <h4>Next topic</h4> <p class="topless"><a href="idle.html" title="next chapter">24.6. IDLE</a></p> <h3>This Page</h3> <ul class="this-page-menu"> <li><a href="../bugs.html">Report a Bug</a></li> <li><a href="../_sources/library/turtle.txt" rel="nofollow">Show Source</a></li> </ul> <div id="searchbox" style="display: none"> <h3>Quick search</h3> <form class="search" action="../search.html" method="get"> <input type="text" name="q" /> <input type="submit" value="Go" /> <input type="hidden" name="check_keywords" value="yes" /> <input type="hidden" name="area" value="default" /> </form> <p class="searchtip" style="font-size: 90%"> Enter search terms or a module, class or function name. </p> </div> <script type="text/javascript">$('#searchbox').show(0);</script> </div> </div> <div class="clearer"></div> </div> <div class="related"> <h3>Navigation</h3> <ul> <li class="right" style="margin-right: 10px"> <a href="../genindex.html" title="General Index" >index</a></li> <li class="right" > <a href="../py-modindex.html" title="Python Module Index" >modules</a> |</li> <li class="right" > <a href="idle.html" title="24.6. IDLE" >next</a> |</li> <li class="right" > <a href="scrolledtext.html" title="24.4. ScrolledText — Scrolled Text Widget" >previous</a> |</li> <li><img src="../_static/py.png" alt="" style="vertical-align: middle; margin-top: -1px"/></li> <li><a href="http://www.python.org/">Python</a> »</li> <li> <a href="../index.html">Python 2.7.5 documentation</a> » </li> <li><a href="index.html" >The Python Standard Library</a> »</li> <li><a href="tk.html" >24. Graphical User Interfaces with Tk</a> »</li> </ul> </div> <div class="footer"> © <a href="../copyright.html">Copyright</a> 1990-2019, Python Software Foundation. <br /> The Python Software Foundation is a non-profit corporation. <a href="http://www.python.org/psf/donations/">Please donate.</a> <br /> Last updated on Jul 03, 2019. <a href="../bugs.html">Found a bug</a>? <br /> Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.1.3. </div> </body> </html>
Close