ducky-python-module 0.1.3__tar.gz → 0.1.5__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {ducky_python_module-0.1.3 → ducky_python_module-0.1.5}/PKG-INFO +10 -3
- ducky_python_module-0.1.5/README.md +14 -0
- {ducky_python_module-0.1.3 → ducky_python_module-0.1.5}/pyproject.toml +2 -1
- {ducky_python_module-0.1.3 → ducky_python_module-0.1.5}/src/ducky/__init__.py +2 -0
- {ducky_python_module-0.1.3 → ducky_python_module-0.1.5}/src/ducky/main.py +87 -483
- {ducky_python_module-0.1.3 → ducky_python_module-0.1.5}/src/ducky_python_module.egg-info/PKG-INFO +10 -3
- ducky_python_module-0.1.3/README.md +0 -7
- {ducky_python_module-0.1.3 → ducky_python_module-0.1.5}/LICENSE.txt +0 -0
- {ducky_python_module-0.1.3 → ducky_python_module-0.1.5}/setup.cfg +0 -0
- {ducky_python_module-0.1.3 → ducky_python_module-0.1.5}/src/ducky_python_module.egg-info/SOURCES.txt +0 -0
- {ducky_python_module-0.1.3 → ducky_python_module-0.1.5}/src/ducky_python_module.egg-info/dependency_links.txt +0 -0
- {ducky_python_module-0.1.3 → ducky_python_module-0.1.5}/src/ducky_python_module.egg-info/requires.txt +0 -0
- {ducky_python_module-0.1.3 → ducky_python_module-0.1.5}/src/ducky_python_module.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: ducky-python-module
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.5
|
|
4
4
|
Summary: Ducky Python module
|
|
5
5
|
Author: Tom
|
|
6
6
|
License: Creative Commons Attribution-NonCommercial 4.0 International Public
|
|
@@ -346,8 +346,15 @@ Dynamic: license-file
|
|
|
346
346
|
|
|
347
347
|
# Ducky-Python-Module
|
|
348
348
|
A collection of tools for python
|
|
349
|
-
Still in progress
|
|
349
|
+
Still in progress and will be releasing fully soon
|
|
350
350
|
Credit:
|
|
351
351
|
Turtle library has been used and modified. I did not make it and I did include the text from the original library explaining rights to the Turtle program which I am not allowed to remove.
|
|
352
352
|
Nltk has been imported but not modified.
|
|
353
|
-
|
|
353
|
+
Full import list:
|
|
354
|
+
import random, time, os, tkinter as TK, types, math, inspect, sys, requests, json, numpy, ast, logging
|
|
355
|
+
from os.path import isfile, split, join
|
|
356
|
+
from copy import deepcopy
|
|
357
|
+
from tkinter import simpledialog
|
|
358
|
+
from turtle import Turtle
|
|
359
|
+
from nltk.tokenize import word_tokenize
|
|
360
|
+
from nltk.stem import LancasterStemmer
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# Ducky-Python-Module
|
|
2
|
+
A collection of tools for python
|
|
3
|
+
Still in progress and will be releasing fully soon
|
|
4
|
+
Credit:
|
|
5
|
+
Turtle library has been used and modified. I did not make it and I did include the text from the original library explaining rights to the Turtle program which I am not allowed to remove.
|
|
6
|
+
Nltk has been imported but not modified.
|
|
7
|
+
Full import list:
|
|
8
|
+
import random, time, os, tkinter as TK, types, math, inspect, sys, requests, json, numpy, ast, logging
|
|
9
|
+
from os.path import isfile, split, join
|
|
10
|
+
from copy import deepcopy
|
|
11
|
+
from tkinter import simpledialog
|
|
12
|
+
from turtle import Turtle
|
|
13
|
+
from nltk.tokenize import word_tokenize
|
|
14
|
+
from nltk.stem import LancasterStemmer
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "ducky-python-module"
|
|
7
|
-
version = "0.1.
|
|
7
|
+
version = "0.1.5"
|
|
8
8
|
description = "Ducky Python module"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.8"
|
|
@@ -28,3 +28,4 @@ where = ["src"]
|
|
|
28
28
|
Repository = "https://github.com/ScubaKINGduck/Ducky-Python-Module"
|
|
29
29
|
Issues = "https://github.com/ScubaKINGduck/Ducky-Python-Module/issues"
|
|
30
30
|
|
|
31
|
+
|
|
@@ -102,6 +102,15 @@ def stem(string):
|
|
|
102
102
|
def array(lst):
|
|
103
103
|
return numpy.array(lst)
|
|
104
104
|
|
|
105
|
+
def dot_product(mat1,mat2):
|
|
106
|
+
return numpy.dot(mat1,mat2)
|
|
107
|
+
|
|
108
|
+
def scale_matrices(mat,val):
|
|
109
|
+
return mat*val
|
|
110
|
+
|
|
111
|
+
def average_matrices(mat):
|
|
112
|
+
return numpy.average(mat)
|
|
113
|
+
|
|
105
114
|
def calc(param):
|
|
106
115
|
try:
|
|
107
116
|
return ast.literal_eval(param)
|
|
@@ -164,6 +173,68 @@ def modify(func,modifier):
|
|
|
164
173
|
|
|
165
174
|
#classes
|
|
166
175
|
|
|
176
|
+
class Tester:
|
|
177
|
+
_instances = []
|
|
178
|
+
@classmethod
|
|
179
|
+
def average(cls):
|
|
180
|
+
total_success = 0
|
|
181
|
+
total_errors = 0
|
|
182
|
+
for instance in cls._instances:
|
|
183
|
+
total_success += len(instance.success)
|
|
184
|
+
total_errors += len(instance.errors)
|
|
185
|
+
total_tests = total_success + total_errors
|
|
186
|
+
if total_tests == 0:
|
|
187
|
+
return 0
|
|
188
|
+
return (total_success / total_tests) * 100
|
|
189
|
+
def __init__(self):
|
|
190
|
+
self.errors = []
|
|
191
|
+
self.success = []
|
|
192
|
+
Tester._instances.append(self)
|
|
193
|
+
print("\033[0m")
|
|
194
|
+
def test(self,code, name="Unnamed"):
|
|
195
|
+
try:
|
|
196
|
+
exec(code, globals())
|
|
197
|
+
self.success.append(name)
|
|
198
|
+
print(f"\033[32mCode:\n{code}\n({name}) executed successfully\n")
|
|
199
|
+
|
|
200
|
+
except Exception as error:
|
|
201
|
+
print(f"\033[31m{error}\n")
|
|
202
|
+
self.errors.append(f"Line: {len(self.errors)+len(self.success)+1} {error}")
|
|
203
|
+
|
|
204
|
+
def results(self):
|
|
205
|
+
total = len(self.success) + len(self.errors)
|
|
206
|
+
if total == 0:
|
|
207
|
+
percent = 0
|
|
208
|
+
else:
|
|
209
|
+
percent = (len(self.success) / total) * 100
|
|
210
|
+
|
|
211
|
+
if percent == 100:
|
|
212
|
+
print("\033[92m------------------------------------------------------------")
|
|
213
|
+
print("\033[92mCompleted 100% successfully:\n")
|
|
214
|
+
|
|
215
|
+
elif percent >= 90:
|
|
216
|
+
print("\033[32m------------------------------------------------------------")
|
|
217
|
+
print("\033[32mCompleted 90% or more successfully:\n")
|
|
218
|
+
|
|
219
|
+
elif percent >= 80:
|
|
220
|
+
print("\033[33m------------------------------------------------------------")
|
|
221
|
+
print("\033[33mCompleted 80% or more successfully:\n")
|
|
222
|
+
elif percent >= 70:
|
|
223
|
+
print("\033[38;5;208m------------------------------------------------------------")
|
|
224
|
+
print("\033[38;5;208mCompleted 70% or more successfully:\n")
|
|
225
|
+
else:
|
|
226
|
+
print("\033[91m------------------------------------------------------------")
|
|
227
|
+
print(f"\033[91mCompleted {percent}% successfully:\n")
|
|
228
|
+
if self.success:
|
|
229
|
+
print(f"\033[32mSuccessful tests:\n")
|
|
230
|
+
for s in self.success:
|
|
231
|
+
print(f"\033[32m{s}")
|
|
232
|
+
if len(self.errors) > 0:
|
|
233
|
+
print(f"\n\033[31mFailed tests:\n")
|
|
234
|
+
for e in self.errors:
|
|
235
|
+
print(f"\033[31m{e}")
|
|
236
|
+
|
|
237
|
+
|
|
167
238
|
class MatrixManager:
|
|
168
239
|
def __init__(self,background,fps,mat=None,wrapping=False,sprite_condition=1):
|
|
169
240
|
self.mat = mat
|
|
@@ -262,17 +333,20 @@ class TurtleManager:
|
|
|
262
333
|
self.colours = colours
|
|
263
334
|
if not self.colours:
|
|
264
335
|
self.colours = ["red","green","blue","yellow","white","black","green","purple"]
|
|
336
|
+
|
|
265
337
|
def colour(self,name=None,index=None):
|
|
266
338
|
if index:
|
|
267
339
|
self.turtle.pencolour(self.colours[index])
|
|
268
340
|
else:
|
|
269
341
|
self.turtle.pencolour(name)
|
|
342
|
+
|
|
270
343
|
def update(self):
|
|
271
344
|
self.width = self.turtle.width()
|
|
272
345
|
self.rotation = self.turtle.heading()
|
|
273
346
|
self.x = self.turtle.xcor()
|
|
274
347
|
self.y = self.turtle.xcor()
|
|
275
348
|
self.pen_down = self.turtle.isdown()
|
|
349
|
+
|
|
276
350
|
def change(self,x=False,y=False,rotation=False,rotation_val=None,width=False,width_val=None,pen_state=False):
|
|
277
351
|
if x and y:
|
|
278
352
|
if self.pen_down:
|
|
@@ -297,6 +371,12 @@ class TurtleManager:
|
|
|
297
371
|
|
|
298
372
|
class Chatbot:
|
|
299
373
|
def __init__(self,testing_input=None,testing_output=None):
|
|
374
|
+
self.greetings = None
|
|
375
|
+
self.farewells = None
|
|
376
|
+
self.time = None
|
|
377
|
+
self.help = None
|
|
378
|
+
self.location = None
|
|
379
|
+
self.user_input = None
|
|
300
380
|
self.testing_input = testing_input
|
|
301
381
|
self.testing_output = testing_output
|
|
302
382
|
self.build()
|
|
@@ -476,9 +556,6 @@ _tg_turtle_functions = ['back', 'backward', 'begin_fill', 'begin_poly', 'bk',
|
|
|
476
556
|
'write', 'xcor', 'ycor']
|
|
477
557
|
_tg_utilities = ['write_docstringdict', 'done']
|
|
478
558
|
|
|
479
|
-
__all__ = (_tg_classes + _tg_screen_functions + _tg_turtle_functions +
|
|
480
|
-
_tg_utilities + ['Terminator']) # + _math_functions)
|
|
481
|
-
|
|
482
559
|
_alias_list = ['addshape', 'backward', 'bk', 'fd', 'ht', 'lt', 'pd', 'pos',
|
|
483
560
|
'pu', 'rt', 'seth', 'setpos', 'setposition', 'st',
|
|
484
561
|
'turtlesize', 'up', 'width']
|
|
@@ -610,7 +687,7 @@ class Vec2D(tuple):
|
|
|
610
687
|
c, s = math.cos(angle), math.sin(angle)
|
|
611
688
|
return Vec2D(self[0]*c+perp[0]*s, self[1]*c+perp[1]*s)
|
|
612
689
|
def __getnewargs__(self):
|
|
613
|
-
return
|
|
690
|
+
return self[0], self[1]
|
|
614
691
|
def __repr__(self):
|
|
615
692
|
return "(%.2f,%.2f)" % self
|
|
616
693
|
|
|
@@ -1081,13 +1158,7 @@ class TurtleScreenBase(object):
|
|
|
1081
1158
|
return self.cv.type(item)
|
|
1082
1159
|
|
|
1083
1160
|
def _pointlist(self, item):
|
|
1084
|
-
|
|
1085
|
-
Example (for insiders):
|
|
1086
|
-
>>> from turtle import *
|
|
1087
|
-
>>> getscreen()._pointlist(getturtle().turtle._item)
|
|
1088
|
-
[(0.0, 9.9999999999999982), (0.0, -9.9999999999999982),
|
|
1089
|
-
(9.9999999999999982, 0.0)]
|
|
1090
|
-
>>> """
|
|
1161
|
+
#returns list of coordinate-pairs of points of item
|
|
1091
1162
|
cl = self.cv.coords(item)
|
|
1092
1163
|
pl = [(cl[i], -cl[i+1]) for i in range(0, len(cl), 2)]
|
|
1093
1164
|
return pl
|
|
@@ -1235,11 +1306,6 @@ class Shape(object):
|
|
|
1235
1306
|
call (for a Shapeobject namend s):
|
|
1236
1307
|
-- s.addcomponent(((0,0), (10,10), (-10,10)), "red", "blue")
|
|
1237
1308
|
|
|
1238
|
-
Example:
|
|
1239
|
-
>>> poly = ((0,0),(10,-5),(0,10),(-10,-5))
|
|
1240
|
-
>>> s = Shape("compound")
|
|
1241
|
-
>>> s.addcomponent(poly, "red", "blue")
|
|
1242
|
-
>>> # .. add more components and then use register_shape()
|
|
1243
1309
|
"""
|
|
1244
1310
|
if self._type != "compound":
|
|
1245
1311
|
raise TurtleGraphicsError("Cannot add component to %s Shape"
|
|
@@ -1279,7 +1345,7 @@ class Tbuffer(object):
|
|
|
1279
1345
|
else:
|
|
1280
1346
|
self.buffer[self.ptr] = [None]
|
|
1281
1347
|
self.ptr = (self.ptr - 1) % self.bufsize
|
|
1282
|
-
return
|
|
1348
|
+
return item
|
|
1283
1349
|
def nr_of_items(self):
|
|
1284
1350
|
return self.bufsize - self.buffer.count([None])
|
|
1285
1351
|
def __repr__(self):
|
|
@@ -1382,10 +1448,6 @@ class TurtleScreen(TurtleScreenBase):
|
|
|
1382
1448
|
'standard' to the right (east) counterclockwise
|
|
1383
1449
|
'logo' upward (north) clockwise
|
|
1384
1450
|
|
|
1385
|
-
Examples:
|
|
1386
|
-
>>> mode('logo') # resets turtle heading to north
|
|
1387
|
-
>>> mode()
|
|
1388
|
-
'logo'
|
|
1389
1451
|
"""
|
|
1390
1452
|
if mode is None:
|
|
1391
1453
|
return self._mode
|
|
@@ -1415,11 +1477,6 @@ class TurtleScreen(TurtleScreenBase):
|
|
|
1415
1477
|
But ATTENTION: in user-defined coordinatesystems angles may appear
|
|
1416
1478
|
distorted. (see Screen.mode())
|
|
1417
1479
|
|
|
1418
|
-
Example (for a TurtleScreen instance named screen):
|
|
1419
|
-
>>> screen.setworldcoordinates(-10,-0.5,50,1.5)
|
|
1420
|
-
>>> for _ in range(36):
|
|
1421
|
-
... left(10)
|
|
1422
|
-
... forward(0.5)
|
|
1423
1480
|
"""
|
|
1424
1481
|
if self.mode() != "world":
|
|
1425
1482
|
self.mode("world")
|
|
@@ -1457,9 +1514,6 @@ class TurtleScreen(TurtleScreenBase):
|
|
|
1457
1514
|
call: register_shape("turtle.gif")
|
|
1458
1515
|
--or: register_shape("tri", ((0,0), (10,10), (-10,10)))
|
|
1459
1516
|
|
|
1460
|
-
Example (for a TurtleScreen instance named screen):
|
|
1461
|
-
>>> screen.register_shape("triangle", ((5,-3),(0,5),(-5,-3)))
|
|
1462
|
-
|
|
1463
1517
|
"""
|
|
1464
1518
|
if shape is None:
|
|
1465
1519
|
# image
|
|
@@ -1513,17 +1567,6 @@ class TurtleScreen(TurtleScreenBase):
|
|
|
1513
1567
|
|
|
1514
1568
|
def colourmode(self, cmode=None):
|
|
1515
1569
|
"""Return the colourmode or set it to 1.0 or 255.
|
|
1516
|
-
|
|
1517
|
-
Optional argument:
|
|
1518
|
-
cmode -- one of the values 1.0 or 255
|
|
1519
|
-
|
|
1520
|
-
r, g, b values of colourtriples have to be in range 0..cmode.
|
|
1521
|
-
|
|
1522
|
-
Example (for a TurtleScreen instance named screen):
|
|
1523
|
-
>>> screen.colourmode()
|
|
1524
|
-
1.0
|
|
1525
|
-
>>> screen.colourmode(255)
|
|
1526
|
-
>>> pencolour(240,160,80)
|
|
1527
1570
|
"""
|
|
1528
1571
|
if cmode is None:
|
|
1529
1572
|
return self._colourmode
|
|
@@ -1537,8 +1580,6 @@ class TurtleScreen(TurtleScreenBase):
|
|
|
1537
1580
|
|
|
1538
1581
|
No argument.
|
|
1539
1582
|
|
|
1540
|
-
Example (for a TurtleScreen instance named screen):
|
|
1541
|
-
>>> screen.reset()
|
|
1542
1583
|
"""
|
|
1543
1584
|
for turtle in self._turtles:
|
|
1544
1585
|
turtle._setmode(self._mode)
|
|
@@ -1547,9 +1588,6 @@ class TurtleScreen(TurtleScreenBase):
|
|
|
1547
1588
|
def turtles(self):
|
|
1548
1589
|
"""Return the list of turtles on the screen.
|
|
1549
1590
|
|
|
1550
|
-
Example (for a TurtleScreen instance named screen):
|
|
1551
|
-
>>> screen.turtles()
|
|
1552
|
-
[<turtle.Turtle object at 0x00E11FB0>]
|
|
1553
1591
|
"""
|
|
1554
1592
|
return self._turtles
|
|
1555
1593
|
|
|
@@ -1559,12 +1597,6 @@ class TurtleScreen(TurtleScreenBase):
|
|
|
1559
1597
|
Arguments (if given): a colour string or three numbers
|
|
1560
1598
|
in the range 0..colourmode or a 3-tuple of such numbers.
|
|
1561
1599
|
|
|
1562
|
-
Example (for a TurtleScreen instance named screen):
|
|
1563
|
-
>>> screen.bgcolour("orange")
|
|
1564
|
-
>>> screen.bgcolour()
|
|
1565
|
-
'orange'
|
|
1566
|
-
>>> screen.bgcolour(0.5,0,0.5)
|
|
1567
|
-
>>> screen.bgcolour()
|
|
1568
1600
|
'#800080'
|
|
1569
1601
|
"""
|
|
1570
1602
|
if args:
|
|
@@ -1587,13 +1619,6 @@ class TurtleScreen(TurtleScreenBase):
|
|
|
1587
1619
|
(Can be used to accelerate the drawing of complex graphics.)
|
|
1588
1620
|
Second arguments sets delay value (see RawTurtle.delay())
|
|
1589
1621
|
|
|
1590
|
-
Example (for a TurtleScreen instance named screen):
|
|
1591
|
-
>>> screen.tracer(8, 25)
|
|
1592
|
-
>>> dist = 2
|
|
1593
|
-
>>> for i in range(200):
|
|
1594
|
-
... fd(dist)
|
|
1595
|
-
... rt(90)
|
|
1596
|
-
... dist += 2
|
|
1597
1622
|
"""
|
|
1598
1623
|
if n is None:
|
|
1599
1624
|
return self._tracing
|
|
@@ -1610,10 +1635,6 @@ class TurtleScreen(TurtleScreenBase):
|
|
|
1610
1635
|
Optional argument:
|
|
1611
1636
|
delay -- positive integer
|
|
1612
1637
|
|
|
1613
|
-
Example (for a TurtleScreen instance named screen):
|
|
1614
|
-
>>> screen.delay(15)
|
|
1615
|
-
>>> screen.delay()
|
|
1616
|
-
15
|
|
1617
1638
|
"""
|
|
1618
1639
|
if delay is None:
|
|
1619
1640
|
return self._delayvalue
|
|
@@ -1642,8 +1663,6 @@ class TurtleScreen(TurtleScreenBase):
|
|
|
1642
1663
|
def window_width(self):
|
|
1643
1664
|
""" Return the width of the turtle window.
|
|
1644
1665
|
|
|
1645
|
-
Example (for a TurtleScreen instance named screen):
|
|
1646
|
-
>>> screen.window_width()
|
|
1647
1666
|
640
|
|
1648
1667
|
"""
|
|
1649
1668
|
return self._window_size()[0]
|
|
@@ -1651,8 +1670,6 @@ class TurtleScreen(TurtleScreenBase):
|
|
|
1651
1670
|
def window_height(self):
|
|
1652
1671
|
""" Return the height of the turtle window.
|
|
1653
1672
|
|
|
1654
|
-
Example (for a TurtleScreen instance named screen):
|
|
1655
|
-
>>> screen.window_height()
|
|
1656
1673
|
480
|
|
1657
1674
|
"""
|
|
1658
1675
|
return self._window_size()[1]
|
|
@@ -1662,10 +1679,6 @@ class TurtleScreen(TurtleScreenBase):
|
|
|
1662
1679
|
|
|
1663
1680
|
No argument.
|
|
1664
1681
|
|
|
1665
|
-
Example (for a Screen instance named screen):
|
|
1666
|
-
>>> cv = screen.getcanvas()
|
|
1667
|
-
>>> cv
|
|
1668
|
-
<turtle.ScrolledCanvas instance at 0x010742D8>
|
|
1669
1682
|
"""
|
|
1670
1683
|
return self.cv
|
|
1671
1684
|
|
|
@@ -1674,27 +1687,10 @@ class TurtleScreen(TurtleScreenBase):
|
|
|
1674
1687
|
|
|
1675
1688
|
No argument.
|
|
1676
1689
|
|
|
1677
|
-
Example (for a TurtleScreen instance named screen):
|
|
1678
|
-
>>> screen.getshapes()
|
|
1679
|
-
['arrow', 'blank', 'circle', ... , 'turtle']
|
|
1680
1690
|
"""
|
|
1681
1691
|
return sorted(self._shapes.keys())
|
|
1682
1692
|
|
|
1683
1693
|
def onclick(self, fun, btn=1, add=None):
|
|
1684
|
-
"""Bind fun to mouse-click event on canvas.
|
|
1685
|
-
|
|
1686
|
-
Arguments:
|
|
1687
|
-
fun -- a function with two arguments, the coordinates of the
|
|
1688
|
-
clicked point on the canvas.
|
|
1689
|
-
btn -- the number of the mouse-button, defaults to 1
|
|
1690
|
-
|
|
1691
|
-
Example (for a TurtleScreen instance named screen)
|
|
1692
|
-
|
|
1693
|
-
>>> screen.onclick(goto)
|
|
1694
|
-
>>> # Subsequently clicking into the TurtleScreen will
|
|
1695
|
-
>>> # make the turtle move to the clicked point.
|
|
1696
|
-
>>> screen.onclick(None)
|
|
1697
|
-
"""
|
|
1698
1694
|
self._onscreenclick(fun, btn, add)
|
|
1699
1695
|
|
|
1700
1696
|
def onkey(self, fun, key):
|
|
@@ -1707,15 +1703,6 @@ class TurtleScreen(TurtleScreenBase):
|
|
|
1707
1703
|
In order to be able to register key-events, TurtleScreen
|
|
1708
1704
|
must have focus. (See method listen.)
|
|
1709
1705
|
|
|
1710
|
-
Example (for a TurtleScreen instance named screen):
|
|
1711
|
-
|
|
1712
|
-
>>> def f():
|
|
1713
|
-
... fd(50)
|
|
1714
|
-
... lt(60)
|
|
1715
|
-
...
|
|
1716
|
-
>>> screen.onkey(f, "Up")
|
|
1717
|
-
>>> screen.listen()
|
|
1718
|
-
|
|
1719
1706
|
Subsequently the turtle can be moved by repeatedly pressing
|
|
1720
1707
|
the up-arrow key, consequently drawing a hexagon
|
|
1721
1708
|
|
|
@@ -1741,13 +1728,6 @@ class TurtleScreen(TurtleScreenBase):
|
|
|
1741
1728
|
Example (for a TurtleScreen instance named screen
|
|
1742
1729
|
and a Turtle instance named turtle):
|
|
1743
1730
|
|
|
1744
|
-
>>> def f():
|
|
1745
|
-
... fd(50)
|
|
1746
|
-
... lt(60)
|
|
1747
|
-
...
|
|
1748
|
-
>>> screen.onkeypress(f, "Up")
|
|
1749
|
-
>>> screen.listen()
|
|
1750
|
-
|
|
1751
1731
|
Subsequently the turtle can be moved by repeatedly pressing
|
|
1752
1732
|
the up-arrow key, or by keeping pressed the up-arrow key.
|
|
1753
1733
|
consequently drawing a hexagon.
|
|
@@ -1766,8 +1746,6 @@ class TurtleScreen(TurtleScreenBase):
|
|
|
1766
1746
|
Dummy arguments are provided in order
|
|
1767
1747
|
to be able to pass listen to the onclick method.
|
|
1768
1748
|
|
|
1769
|
-
Example (for a TurtleScreen instance named screen):
|
|
1770
|
-
>>> screen.listen()
|
|
1771
1749
|
"""
|
|
1772
1750
|
self._listen()
|
|
1773
1751
|
|
|
@@ -1778,17 +1756,6 @@ class TurtleScreen(TurtleScreenBase):
|
|
|
1778
1756
|
fun -- a function with no arguments.
|
|
1779
1757
|
t -- a number >= 0
|
|
1780
1758
|
|
|
1781
|
-
Example (for a TurtleScreen instance named screen):
|
|
1782
|
-
|
|
1783
|
-
>>> running = True
|
|
1784
|
-
>>> def f():
|
|
1785
|
-
... if running:
|
|
1786
|
-
... fd(50)
|
|
1787
|
-
... lt(60)
|
|
1788
|
-
... screen.ontimer(f, 250)
|
|
1789
|
-
...
|
|
1790
|
-
>>> f() # makes the turtle marching around
|
|
1791
|
-
>>> running = False
|
|
1792
1759
|
"""
|
|
1793
1760
|
self._ontimer(fun, t)
|
|
1794
1761
|
|
|
@@ -1802,12 +1769,6 @@ class TurtleScreen(TurtleScreenBase):
|
|
|
1802
1769
|
If picname is "nopic", delete backgroundimage, if present.
|
|
1803
1770
|
If picname is None, return the filename of the current backgroundimage.
|
|
1804
1771
|
|
|
1805
|
-
Example (for a TurtleScreen instance named screen):
|
|
1806
|
-
>>> screen.bgpic()
|
|
1807
|
-
'nopic'
|
|
1808
|
-
>>> screen.bgpic("landscape.gif")
|
|
1809
|
-
>>> screen.bgpic()
|
|
1810
|
-
'landscape.gif'
|
|
1811
1772
|
"""
|
|
1812
1773
|
if picname is None:
|
|
1813
1774
|
return self._bgpicname
|
|
@@ -1829,9 +1790,6 @@ class TurtleScreen(TurtleScreenBase):
|
|
|
1829
1790
|
the canvas use the scrollbars. (Can make visible those parts
|
|
1830
1791
|
of a drawing, which were outside the canvas before!)
|
|
1831
1792
|
|
|
1832
|
-
Example (for a Turtle instance named turtle):
|
|
1833
|
-
>>> turtle.screensize(2000,1500)
|
|
1834
|
-
>>> # e.g. to search for an erroneously escaped turtle ;-)
|
|
1835
1793
|
"""
|
|
1836
1794
|
return self._resize(canvwidth, canvheight, bg)
|
|
1837
1795
|
|
|
@@ -1905,17 +1863,6 @@ class TNavigator(object):
|
|
|
1905
1863
|
of 'degrees' for a full circle. Default value is
|
|
1906
1864
|
360 degrees.
|
|
1907
1865
|
|
|
1908
|
-
Example (for a Turtle instance named turtle):
|
|
1909
|
-
>>> turtle.left(90)
|
|
1910
|
-
>>> turtle.heading()
|
|
1911
|
-
90
|
|
1912
|
-
|
|
1913
|
-
Change angle measurement unit to grad (also known as gon,
|
|
1914
|
-
grade, or gradian and equals 1/100-th of the right angle.)
|
|
1915
|
-
>>> turtle.degrees(400.0)
|
|
1916
|
-
>>> turtle.heading()
|
|
1917
|
-
100
|
|
1918
|
-
|
|
1919
1866
|
"""
|
|
1920
1867
|
self._setDegreesPerAU(fullcircle)
|
|
1921
1868
|
|
|
@@ -1924,12 +1871,6 @@ class TNavigator(object):
|
|
|
1924
1871
|
|
|
1925
1872
|
No arguments.
|
|
1926
1873
|
|
|
1927
|
-
Example (for a Turtle instance named turtle):
|
|
1928
|
-
>>> turtle.heading()
|
|
1929
|
-
90
|
|
1930
|
-
>>> turtle.radians()
|
|
1931
|
-
>>> turtle.heading()
|
|
1932
|
-
1.5707963267948966
|
|
1933
1874
|
"""
|
|
1934
1875
|
self._setDegreesPerAU(math.tau)
|
|
1935
1876
|
|
|
@@ -1958,15 +1899,6 @@ class TNavigator(object):
|
|
|
1958
1899
|
Move the turtle forward by the specified distance, in the direction
|
|
1959
1900
|
the turtle is headed.
|
|
1960
1901
|
|
|
1961
|
-
Example (for a Turtle instance named turtle):
|
|
1962
|
-
>>> turtle.position()
|
|
1963
|
-
(0.00, 0.00)
|
|
1964
|
-
>>> turtle.forward(25)
|
|
1965
|
-
>>> turtle.position()
|
|
1966
|
-
(25.00,0.00)
|
|
1967
|
-
>>> turtle.forward(-75)
|
|
1968
|
-
>>> turtle.position()
|
|
1969
|
-
(-50.00,0.00)
|
|
1970
1902
|
"""
|
|
1971
1903
|
self._go(distance)
|
|
1972
1904
|
|
|
@@ -1981,12 +1913,6 @@ class TNavigator(object):
|
|
|
1981
1913
|
Move the turtle backward by distance, opposite to the direction the
|
|
1982
1914
|
turtle is headed. Do not change the turtle's heading.
|
|
1983
1915
|
|
|
1984
|
-
Example (for a Turtle instance named turtle):
|
|
1985
|
-
>>> turtle.position()
|
|
1986
|
-
(0.00, 0.00)
|
|
1987
|
-
>>> turtle.backward(30)
|
|
1988
|
-
>>> turtle.position()
|
|
1989
|
-
(-30.00, 0.00)
|
|
1990
1916
|
"""
|
|
1991
1917
|
self._go(-distance)
|
|
1992
1918
|
|
|
@@ -2002,12 +1928,6 @@ class TNavigator(object):
|
|
|
2002
1928
|
but can be set via the degrees() and radians() functions.)
|
|
2003
1929
|
Angle orientation depends on mode. (See this.)
|
|
2004
1930
|
|
|
2005
|
-
Example (for a Turtle instance named turtle):
|
|
2006
|
-
>>> turtle.heading()
|
|
2007
|
-
22.0
|
|
2008
|
-
>>> turtle.right(45)
|
|
2009
|
-
>>> turtle.heading()
|
|
2010
|
-
337.0
|
|
2011
1931
|
"""
|
|
2012
1932
|
self._rotate(-angle)
|
|
2013
1933
|
|
|
@@ -2023,12 +1943,6 @@ class TNavigator(object):
|
|
|
2023
1943
|
but can be set via the degrees() and radians() functions.)
|
|
2024
1944
|
Angle orientation depends on mode. (See this.)
|
|
2025
1945
|
|
|
2026
|
-
Example (for a Turtle instance named turtle):
|
|
2027
|
-
>>> turtle.heading()
|
|
2028
|
-
22.0
|
|
2029
|
-
>>> turtle.left(45)
|
|
2030
|
-
>>> turtle.heading()
|
|
2031
|
-
67.0
|
|
2032
1946
|
"""
|
|
2033
1947
|
self._rotate(angle)
|
|
2034
1948
|
|
|
@@ -2039,9 +1953,6 @@ class TNavigator(object):
|
|
|
2039
1953
|
|
|
2040
1954
|
No arguments.
|
|
2041
1955
|
|
|
2042
|
-
Example (for a Turtle instance named turtle):
|
|
2043
|
-
>>> turtle.pos()
|
|
2044
|
-
(0.00, 240.00)
|
|
2045
1956
|
"""
|
|
2046
1957
|
return self._position
|
|
2047
1958
|
|
|
@@ -2050,12 +1961,6 @@ class TNavigator(object):
|
|
|
2050
1961
|
|
|
2051
1962
|
No arguments.
|
|
2052
1963
|
|
|
2053
|
-
Example (for a Turtle instance named turtle):
|
|
2054
|
-
>>> reset()
|
|
2055
|
-
>>> turtle.left(60)
|
|
2056
|
-
>>> turtle.forward(100)
|
|
2057
|
-
>>> print turtle.xcor()
|
|
2058
|
-
50.0
|
|
2059
1964
|
"""
|
|
2060
1965
|
return self._position[0]
|
|
2061
1966
|
|
|
@@ -2064,12 +1969,6 @@ class TNavigator(object):
|
|
|
2064
1969
|
---
|
|
2065
1970
|
No arguments.
|
|
2066
1971
|
|
|
2067
|
-
Example (for a Turtle instance named turtle):
|
|
2068
|
-
>>> reset()
|
|
2069
|
-
>>> turtle.left(60)
|
|
2070
|
-
>>> turtle.forward(100)
|
|
2071
|
-
>>> print turtle.ycor()
|
|
2072
|
-
86.6025403784
|
|
2073
1972
|
"""
|
|
2074
1973
|
return self._position[1]
|
|
2075
1974
|
|
|
@@ -2090,19 +1989,6 @@ class TNavigator(object):
|
|
|
2090
1989
|
Move turtle to an absolute position. If the pen is down,
|
|
2091
1990
|
a line will be drawn. The turtle's orientation does not change.
|
|
2092
1991
|
|
|
2093
|
-
Example (for a Turtle instance named turtle):
|
|
2094
|
-
>>> tp = turtle.pos()
|
|
2095
|
-
>>> tp
|
|
2096
|
-
(0.00, 0.00)
|
|
2097
|
-
>>> turtle.setpos(60,30)
|
|
2098
|
-
>>> turtle.pos()
|
|
2099
|
-
(60.00,30.00)
|
|
2100
|
-
>>> turtle.setpos((20,80))
|
|
2101
|
-
>>> turtle.pos()
|
|
2102
|
-
(20.00,80.00)
|
|
2103
|
-
>>> turtle.setpos(tp)
|
|
2104
|
-
>>> turtle.pos()
|
|
2105
|
-
(0.00,0.00)
|
|
2106
1992
|
"""
|
|
2107
1993
|
if y is None:
|
|
2108
1994
|
self._goto(Vec2D(*x))
|
|
@@ -2117,8 +2003,6 @@ class TNavigator(object):
|
|
|
2117
2003
|
Move turtle to the origin - coordinates (0,0) and set its
|
|
2118
2004
|
heading to its start-orientation (which depends on mode).
|
|
2119
2005
|
|
|
2120
|
-
Example (for a Turtle instance named turtle):
|
|
2121
|
-
>>> turtle.home()
|
|
2122
2006
|
"""
|
|
2123
2007
|
self.goto(0, 0)
|
|
2124
2008
|
self.setheading(0)
|
|
@@ -2132,12 +2016,6 @@ class TNavigator(object):
|
|
|
2132
2016
|
Set the turtle's first coordinate to x, leave second coordinate
|
|
2133
2017
|
unchanged.
|
|
2134
2018
|
|
|
2135
|
-
Example (for a Turtle instance named turtle):
|
|
2136
|
-
>>> turtle.position()
|
|
2137
|
-
(0.00, 240.00)
|
|
2138
|
-
>>> turtle.setx(10)
|
|
2139
|
-
>>> turtle.position()
|
|
2140
|
-
(10.00, 240.00)
|
|
2141
2019
|
"""
|
|
2142
2020
|
self._goto(Vec2D(x, self._position[1]))
|
|
2143
2021
|
|
|
@@ -2150,12 +2028,6 @@ class TNavigator(object):
|
|
|
2150
2028
|
Set the turtle's first coordinate to x, second coordinate remains
|
|
2151
2029
|
unchanged.
|
|
2152
2030
|
|
|
2153
|
-
Example (for a Turtle instance named turtle):
|
|
2154
|
-
>>> turtle.position()
|
|
2155
|
-
(0.00, 40.00)
|
|
2156
|
-
>>> turtle.sety(-10)
|
|
2157
|
-
>>> turtle.position()
|
|
2158
|
-
(0.00, -10.00)
|
|
2159
2031
|
"""
|
|
2160
2032
|
self._goto(Vec2D(self._position[0], y))
|
|
2161
2033
|
|
|
@@ -2171,15 +2043,6 @@ class TNavigator(object):
|
|
|
2171
2043
|
--or: distance(vec) # e.g. as returned by pos()
|
|
2172
2044
|
--or: distance(mypen) # where mypen is another turtle
|
|
2173
2045
|
|
|
2174
|
-
Example (for a Turtle instance named turtle):
|
|
2175
|
-
>>> turtle.pos()
|
|
2176
|
-
(0.00, 0.00)
|
|
2177
|
-
>>> turtle.distance(30,40)
|
|
2178
|
-
50.0
|
|
2179
|
-
>>> pen = Turtle()
|
|
2180
|
-
>>> pen.forward(77)
|
|
2181
|
-
>>> turtle.distance(pen)
|
|
2182
|
-
77.0
|
|
2183
2046
|
"""
|
|
2184
2047
|
if y is not None:
|
|
2185
2048
|
pos = Vec2D(x, y)
|
|
@@ -2207,11 +2070,6 @@ class TNavigator(object):
|
|
|
2207
2070
|
specified by x, y and the turtle's start orientation. (Depends on
|
|
2208
2071
|
modes - "standard" or "logo")
|
|
2209
2072
|
|
|
2210
|
-
Example (for a Turtle instance named turtle):
|
|
2211
|
-
>>> turtle.pos()
|
|
2212
|
-
(10.00, 10.00)
|
|
2213
|
-
>>> turtle.towards(0,0)
|
|
2214
|
-
225.0
|
|
2215
2073
|
"""
|
|
2216
2074
|
if y is not None:
|
|
2217
2075
|
pos = Vec2D(x, y)
|
|
@@ -2231,10 +2089,6 @@ class TNavigator(object):
|
|
|
2231
2089
|
|
|
2232
2090
|
No arguments.
|
|
2233
2091
|
|
|
2234
|
-
Example (for a Turtle instance named turtle):
|
|
2235
|
-
>>> turtle.left(67)
|
|
2236
|
-
>>> turtle.heading()
|
|
2237
|
-
67.0
|
|
2238
2092
|
"""
|
|
2239
2093
|
x, y = self._orient
|
|
2240
2094
|
result = round(math.degrees(math.atan2(y, x)), 10) % 360.0
|
|
@@ -2259,10 +2113,6 @@ class TNavigator(object):
|
|
|
2259
2113
|
180 - west 180 - south
|
|
2260
2114
|
270 - south 270 - west
|
|
2261
2115
|
|
|
2262
|
-
Example (for a Turtle instance named turtle):
|
|
2263
|
-
>>> turtle.setheading(90)
|
|
2264
|
-
>>> turtle.heading()
|
|
2265
|
-
90
|
|
2266
2116
|
"""
|
|
2267
2117
|
angle = (to_angle - self.heading())*self._angleOrient
|
|
2268
2118
|
full = self._fullcircle
|
|
@@ -2295,9 +2145,7 @@ class TNavigator(object):
|
|
|
2295
2145
|
--or: circle(radius, extent, steps)
|
|
2296
2146
|
--or: circle(radius, steps=6) # 6-sided polygon
|
|
2297
2147
|
|
|
2298
|
-
|
|
2299
|
-
>>> turtle.circle(50)
|
|
2300
|
-
>>> turtle.circle(120, 180) # semicircle
|
|
2148
|
+
|
|
2301
2149
|
"""
|
|
2302
2150
|
if self.undobuffer:
|
|
2303
2151
|
self.undobuffer.push(["seq"])
|
|
@@ -2391,10 +2239,6 @@ class TPen(object):
|
|
|
2391
2239
|
If no argument is given, return current resizemode.
|
|
2392
2240
|
resizemode("user") is called by a call of shapesize with arguments.
|
|
2393
2241
|
|
|
2394
|
-
|
|
2395
|
-
Examples (for a Turtle instance named turtle):
|
|
2396
|
-
>>> turtle.resizemode("noresize")
|
|
2397
|
-
>>> turtle.resizemode()
|
|
2398
2242
|
'noresize'
|
|
2399
2243
|
"""
|
|
2400
2244
|
if rmode is None:
|
|
@@ -2416,10 +2260,6 @@ class TPen(object):
|
|
|
2416
2260
|
the same line thickness. If no argument is given, current pensize
|
|
2417
2261
|
is returned.
|
|
2418
2262
|
|
|
2419
|
-
Example (for a Turtle instance named turtle):
|
|
2420
|
-
>>> turtle.pensize()
|
|
2421
|
-
1
|
|
2422
|
-
>>> turtle.pensize(10) # from here on lines of width 10 are drawn
|
|
2423
2263
|
"""
|
|
2424
2264
|
if width is None:
|
|
2425
2265
|
return self._pensize
|
|
@@ -2433,8 +2273,6 @@ class TPen(object):
|
|
|
2433
2273
|
|
|
2434
2274
|
No argument
|
|
2435
2275
|
|
|
2436
|
-
Example (for a Turtle instance named turtle):
|
|
2437
|
-
>>> turtle.penup()
|
|
2438
2276
|
"""
|
|
2439
2277
|
if not self._drawing:
|
|
2440
2278
|
return
|
|
@@ -2447,8 +2285,6 @@ class TPen(object):
|
|
|
2447
2285
|
|
|
2448
2286
|
No argument.
|
|
2449
2287
|
|
|
2450
|
-
Example (for a Turtle instance named turtle):
|
|
2451
|
-
>>> turtle.pendown()
|
|
2452
2288
|
"""
|
|
2453
2289
|
if self._drawing:
|
|
2454
2290
|
return
|
|
@@ -2459,13 +2295,6 @@ class TPen(object):
|
|
|
2459
2295
|
|
|
2460
2296
|
No argument.
|
|
2461
2297
|
|
|
2462
|
-
Example (for a Turtle instance named turtle):
|
|
2463
|
-
>>> turtle.penup()
|
|
2464
|
-
>>> turtle.isdown()
|
|
2465
|
-
False
|
|
2466
|
-
>>> turtle.pendown()
|
|
2467
|
-
>>> turtle.isdown()
|
|
2468
|
-
True
|
|
2469
2298
|
"""
|
|
2470
2299
|
return self._drawing
|
|
2471
2300
|
|
|
@@ -2493,8 +2322,6 @@ class TPen(object):
|
|
|
2493
2322
|
speed = 0 : *no* animation takes place. forward/back makes turtle jump
|
|
2494
2323
|
and likewise left/right make the turtle turn instantly.
|
|
2495
2324
|
|
|
2496
|
-
Example (for a Turtle instance named turtle):
|
|
2497
|
-
>>> turtle.speed(3)
|
|
2498
2325
|
"""
|
|
2499
2326
|
speeds = {'fastest':0, 'fast':10, 'normal':6, 'slow':3, 'slowest':1 }
|
|
2500
2327
|
if speed is None:
|
|
@@ -2530,14 +2357,6 @@ class TPen(object):
|
|
|
2530
2357
|
is drawn with the newly set colours.
|
|
2531
2358
|
For more info see: pencolour, fillcolour
|
|
2532
2359
|
|
|
2533
|
-
Example (for a Turtle instance named turtle):
|
|
2534
|
-
>>> turtle.colour('red', 'green')
|
|
2535
|
-
>>> turtle.colour()
|
|
2536
|
-
('red', 'green')
|
|
2537
|
-
>>> colourmode(255)
|
|
2538
|
-
>>> colour((40, 80, 120), (160, 200, 240))
|
|
2539
|
-
>>> colour()
|
|
2540
|
-
('#285078', '#a0c8f0')
|
|
2541
2360
|
"""
|
|
2542
2361
|
if args:
|
|
2543
2362
|
l = len(args)
|
|
@@ -2575,12 +2394,6 @@ class TPen(object):
|
|
|
2575
2394
|
If turtleshape is a polygon, the outline of that polygon is drawn
|
|
2576
2395
|
with the newly set pencolour.
|
|
2577
2396
|
|
|
2578
|
-
Example (for a Turtle instance named turtle):
|
|
2579
|
-
>>> turtle.pencolour('brown')
|
|
2580
|
-
>>> tup = (0.2, 0.8, 0.55)
|
|
2581
|
-
>>> turtle.pencolour(tup)
|
|
2582
|
-
>>> turtle.pencolour()
|
|
2583
|
-
'#33cc8c'
|
|
2584
2397
|
"""
|
|
2585
2398
|
if args:
|
|
2586
2399
|
colour = self._colourstr(args)
|
|
@@ -2612,11 +2425,6 @@ class TPen(object):
|
|
|
2612
2425
|
If turtleshape is a polygon, the interior of that polygon is drawn
|
|
2613
2426
|
with the newly set fillcolour.
|
|
2614
2427
|
|
|
2615
|
-
Example (for a Turtle instance named turtle):
|
|
2616
|
-
>>> turtle.fillcolour('violet')
|
|
2617
|
-
>>> col = turtle.pencolour()
|
|
2618
|
-
>>> turtle.fillcolour(col)
|
|
2619
|
-
>>> turtle.fillcolour(0, .5, 0)
|
|
2620
2428
|
"""
|
|
2621
2429
|
if args:
|
|
2622
2430
|
colour = self._colourstr(args)
|
|
@@ -2633,9 +2441,6 @@ class TPen(object):
|
|
|
2633
2441
|
|
|
2634
2442
|
No argument.
|
|
2635
2443
|
|
|
2636
|
-
Example (for a Turtle instance named turtle):
|
|
2637
|
-
>>> turtle.hideturtle()
|
|
2638
|
-
>>> turtle.showturtle()
|
|
2639
2444
|
"""
|
|
2640
2445
|
self.pen(shown=True)
|
|
2641
2446
|
|
|
@@ -2650,8 +2455,6 @@ class TPen(object):
|
|
|
2650
2455
|
middle of a complicated drawing, because hiding
|
|
2651
2456
|
the turtle speeds up the drawing observably.
|
|
2652
2457
|
|
|
2653
|
-
Example (for a Turtle instance named turtle):
|
|
2654
|
-
>>> turtle.hideturtle()
|
|
2655
2458
|
"""
|
|
2656
2459
|
self.pen(shown=False)
|
|
2657
2460
|
|
|
@@ -2661,8 +2464,6 @@ class TPen(object):
|
|
|
2661
2464
|
No argument.
|
|
2662
2465
|
|
|
2663
2466
|
Example (for a Turtle instance named turtle):
|
|
2664
|
-
>>> turtle.hideturtle()
|
|
2665
|
-
>>> print turtle.isvisible():
|
|
2666
2467
|
False
|
|
2667
2468
|
"""
|
|
2668
2469
|
return self._shown
|
|
@@ -2694,25 +2495,6 @@ class TPen(object):
|
|
|
2694
2495
|
or more of these attributes can be provided as keyword-arguments.
|
|
2695
2496
|
This can be used to set several pen attributes in one statement.
|
|
2696
2497
|
|
|
2697
|
-
|
|
2698
|
-
Examples (for a Turtle instance named turtle):
|
|
2699
|
-
>>> turtle.pen(fillcolour="black", pencolour="red", pensize=10)
|
|
2700
|
-
>>> turtle.pen()
|
|
2701
|
-
{'pensize': 10, 'shown': True, 'resizemode': 'auto', 'outline': 1,
|
|
2702
|
-
'pencolour': 'red', 'pendown': True, 'fillcolour': 'black',
|
|
2703
|
-
'stretchfactor': (1,1), 'speed': 3, 'shearfactor': 0.0}
|
|
2704
|
-
>>> penstate=turtle.pen()
|
|
2705
|
-
>>> turtle.colour("yellow","")
|
|
2706
|
-
>>> turtle.penup()
|
|
2707
|
-
>>> turtle.pen()
|
|
2708
|
-
{'pensize': 10, 'shown': True, 'resizemode': 'auto', 'outline': 1,
|
|
2709
|
-
'pencolour': 'yellow', 'pendown': False, 'fillcolour': '',
|
|
2710
|
-
'stretchfactor': (1,1), 'speed': 3, 'shearfactor': 0.0}
|
|
2711
|
-
>>> p.pen(penstate, fillcolour="green")
|
|
2712
|
-
>>> p.pen()
|
|
2713
|
-
{'pensize': 10, 'shown': True, 'resizemode': 'auto', 'outline': 1,
|
|
2714
|
-
'pencolour': 'red', 'pendown': True, 'fillcolour': 'green',
|
|
2715
|
-
'stretchfactor': (1,1), 'speed': 3, 'shearfactor': 0.0}
|
|
2716
2498
|
"""
|
|
2717
2499
|
_pd = {"shown" : self._shown,
|
|
2718
2500
|
"pendown" : self._drawing,
|
|
@@ -2898,16 +2680,6 @@ class RawTurtle(TPen, TNavigator):
|
|
|
2898
2680
|
Delete the turtle's drawings from the screen, re-center the turtle
|
|
2899
2681
|
and set variables to the default values.
|
|
2900
2682
|
|
|
2901
|
-
Example (for a Turtle instance named turtle):
|
|
2902
|
-
>>> turtle.position()
|
|
2903
|
-
(0.00,-22.00)
|
|
2904
|
-
>>> turtle.heading()
|
|
2905
|
-
100.0
|
|
2906
|
-
>>> turtle.reset()
|
|
2907
|
-
>>> turtle.position()
|
|
2908
|
-
(0.00,0.00)
|
|
2909
|
-
>>> turtle.heading()
|
|
2910
|
-
0.0
|
|
2911
2683
|
"""
|
|
2912
2684
|
TNavigator.reset(self)
|
|
2913
2685
|
TPen._reset(self)
|
|
@@ -2926,8 +2698,6 @@ class RawTurtle(TPen, TNavigator):
|
|
|
2926
2698
|
by the undo() function.
|
|
2927
2699
|
If size is None, no undobuffer is present.
|
|
2928
2700
|
|
|
2929
|
-
Example (for a Turtle instance named turtle):
|
|
2930
|
-
>>> turtle.setundobuffer(42)
|
|
2931
2701
|
"""
|
|
2932
2702
|
if size is None or size <= 0:
|
|
2933
2703
|
self.undobuffer = None
|
|
@@ -2939,9 +2709,6 @@ class RawTurtle(TPen, TNavigator):
|
|
|
2939
2709
|
|
|
2940
2710
|
No argument.
|
|
2941
2711
|
|
|
2942
|
-
Example (for a Turtle instance named turtle):
|
|
2943
|
-
>>> while undobufferentries():
|
|
2944
|
-
... undo()
|
|
2945
2712
|
"""
|
|
2946
2713
|
if self.undobuffer is None:
|
|
2947
2714
|
return 0
|
|
@@ -2970,8 +2737,6 @@ class RawTurtle(TPen, TNavigator):
|
|
|
2970
2737
|
State and position of the turtle as well as drawings of other
|
|
2971
2738
|
turtles are not affected.
|
|
2972
2739
|
|
|
2973
|
-
Examples (for a Turtle instance named turtle):
|
|
2974
|
-
>>> turtle.clear()
|
|
2975
2740
|
"""
|
|
2976
2741
|
self._clear()
|
|
2977
2742
|
self._update()
|
|
@@ -3013,13 +2778,6 @@ class RawTurtle(TPen, TNavigator):
|
|
|
3013
2778
|
(Can be used to accelerate the drawing of complex graphics.)
|
|
3014
2779
|
Second arguments sets delay value (see RawTurtle.delay())
|
|
3015
2780
|
|
|
3016
|
-
Example (for a Turtle instance named turtle):
|
|
3017
|
-
>>> turtle.tracer(8, 25)
|
|
3018
|
-
>>> dist = 2
|
|
3019
|
-
>>> for i in range(200):
|
|
3020
|
-
... turtle.fd(dist)
|
|
3021
|
-
... turtle.rt(90)
|
|
3022
|
-
... dist += 2
|
|
3023
2781
|
"""
|
|
3024
2782
|
return self.screen.tracer(flag, delay)
|
|
3025
2783
|
|
|
@@ -3097,12 +2855,6 @@ class RawTurtle(TPen, TNavigator):
|
|
|
3097
2855
|
'arrow', 'turtle', 'circle', 'square', 'triangle', 'classic'.
|
|
3098
2856
|
To learn about how to deal with shapes see Screen-method register_shape.
|
|
3099
2857
|
|
|
3100
|
-
Example (for a Turtle instance named turtle):
|
|
3101
|
-
>>> turtle.shape()
|
|
3102
|
-
'arrow'
|
|
3103
|
-
>>> turtle.shape("turtle")
|
|
3104
|
-
>>> turtle.shape()
|
|
3105
|
-
'turtle'
|
|
3106
2858
|
"""
|
|
3107
2859
|
if name is None:
|
|
3108
2860
|
return self.turtle.shapeIndex
|
|
@@ -3125,12 +2877,8 @@ class RawTurtle(TPen, TNavigator):
|
|
|
3125
2877
|
stretched according to its stretchfactors:
|
|
3126
2878
|
stretch_wid is stretchfactor perpendicular to orientation
|
|
3127
2879
|
stretch_len is stretchfactor in direction of turtles orientation.
|
|
3128
|
-
outline determines the width of the shapes'
|
|
2880
|
+
outline determines the width of the shapes' outline.
|
|
3129
2881
|
|
|
3130
|
-
Examples (for a Turtle instance named turtle):
|
|
3131
|
-
>>> turtle.resizemode("user")
|
|
3132
|
-
>>> turtle.shapesize(5, 5, 12)
|
|
3133
|
-
>>> turtle.shapesize(outline=8)
|
|
3134
2882
|
"""
|
|
3135
2883
|
if stretch_wid is stretch_len is outline is None:
|
|
3136
2884
|
stretch_wid, stretch_len = self._stretchfactor
|
|
@@ -3159,16 +2907,10 @@ class RawTurtle(TPen, TNavigator):
|
|
|
3159
2907
|
Shear the turtleshape according to the given shearfactor shear,
|
|
3160
2908
|
which is the tangent of the shear angle. DO NOT change the
|
|
3161
2909
|
turtle's heading (direction of movement).
|
|
3162
|
-
If shear is not given: return the current shearfactor, i.
|
|
2910
|
+
If shear is not given: return the current shearfactor, i.e. the
|
|
3163
2911
|
tangent of the shear angle, by which lines parallel to the
|
|
3164
2912
|
heading of the turtle are sheared.
|
|
3165
2913
|
|
|
3166
|
-
Examples (for a Turtle instance named turtle):
|
|
3167
|
-
>>> turtle.shape("circle")
|
|
3168
|
-
>>> turtle.shapesize(5,2)
|
|
3169
|
-
>>> turtle.shearfactor(0.5)
|
|
3170
|
-
>>> turtle.shearfactor()
|
|
3171
|
-
>>> 0.5
|
|
3172
2914
|
"""
|
|
3173
2915
|
if shear is None:
|
|
3174
2916
|
return self._shearfactor
|
|
@@ -3183,16 +2925,6 @@ class RawTurtle(TPen, TNavigator):
|
|
|
3183
2925
|
regardless of its current tilt-angle. DO NOT change the turtle's
|
|
3184
2926
|
heading (direction of movement).
|
|
3185
2927
|
|
|
3186
|
-
|
|
3187
|
-
Examples (for a Turtle instance named turtle):
|
|
3188
|
-
>>> turtle.shape("circle")
|
|
3189
|
-
>>> turtle.shapesize(5,2)
|
|
3190
|
-
>>> turtle.settiltangle(45)
|
|
3191
|
-
>>> stamp()
|
|
3192
|
-
>>> turtle.fd(50)
|
|
3193
|
-
>>> turtle.settiltangle(-45)
|
|
3194
|
-
>>> stamp()
|
|
3195
|
-
>>> turtle.fd(50)
|
|
3196
2928
|
"""
|
|
3197
2929
|
tilt = -angle * self._degreesPerAU * self._angleOrient
|
|
3198
2930
|
tilt = math.radians(tilt) % math.tau
|
|
@@ -3213,11 +2945,6 @@ class RawTurtle(TPen, TNavigator):
|
|
|
3213
2945
|
(Incorrectly marked as deprecated since Python 3.1, it is really
|
|
3214
2946
|
settiltangle that is deprecated.)
|
|
3215
2947
|
|
|
3216
|
-
Examples (for a Turtle instance named turtle):
|
|
3217
|
-
>>> turtle.shape("circle")
|
|
3218
|
-
>>> turtle.shapesize(5,2)
|
|
3219
|
-
>>> turtle.tilt(45)
|
|
3220
|
-
>>> turtle.tiltangle()
|
|
3221
2948
|
"""
|
|
3222
2949
|
if angle is None:
|
|
3223
2950
|
tilt = -math.degrees(self._tilt) * self._angleOrient
|
|
@@ -3234,13 +2961,6 @@ class RawTurtle(TPen, TNavigator):
|
|
|
3234
2961
|
Rotate the turtleshape by angle from its current tilt-angle,
|
|
3235
2962
|
but do NOT change the turtle's heading (direction of movement).
|
|
3236
2963
|
|
|
3237
|
-
Examples (for a Turtle instance named turtle):
|
|
3238
|
-
>>> turtle.shape("circle")
|
|
3239
|
-
>>> turtle.shapesize(5,2)
|
|
3240
|
-
>>> turtle.tilt(30)
|
|
3241
|
-
>>> turtle.fd(50)
|
|
3242
|
-
>>> turtle.tilt(30)
|
|
3243
|
-
>>> turtle.fd(50)
|
|
3244
2964
|
"""
|
|
3245
2965
|
self.settiltangle(angle + self.tiltangle())
|
|
3246
2966
|
|
|
@@ -3257,11 +2977,6 @@ class RawTurtle(TPen, TNavigator):
|
|
|
3257
2977
|
Modify stretchfactor, shearfactor and tiltangle according to the
|
|
3258
2978
|
given matrix.
|
|
3259
2979
|
|
|
3260
|
-
Examples (for a Turtle instance named turtle):
|
|
3261
|
-
>>> turtle.shape("square")
|
|
3262
|
-
>>> turtle.shapesize(4,2)
|
|
3263
|
-
>>> turtle.shearfactor(-0.5)
|
|
3264
|
-
>>> turtle.shapetransform()
|
|
3265
2980
|
(4.0, -1.0, -0.0, 2.0)
|
|
3266
2981
|
"""
|
|
3267
2982
|
if t11 is t12 is t21 is t22 is None:
|
|
@@ -3300,13 +3015,6 @@ class RawTurtle(TPen, TNavigator):
|
|
|
3300
3015
|
"""Return the current shape polygon as tuple of coordinate pairs.
|
|
3301
3016
|
|
|
3302
3017
|
No argument.
|
|
3303
|
-
|
|
3304
|
-
Examples (for a Turtle instance named turtle):
|
|
3305
|
-
>>> turtle.shape("square")
|
|
3306
|
-
>>> turtle.shapetransform(4, -1, 0, 2)
|
|
3307
|
-
>>> turtle.get_shapepoly()
|
|
3308
|
-
((50, -20), (30, 20), (-50, 20), (-30, -20))
|
|
3309
|
-
|
|
3310
3018
|
"""
|
|
3311
3019
|
shape = self.screen._shapes[self.turtle.shapeIndex]
|
|
3312
3020
|
if shape._type == "polygon":
|
|
@@ -3375,11 +3083,6 @@ class RawTurtle(TPen, TNavigator):
|
|
|
3375
3083
|
turtle position. Return a stamp_id for that stamp, which can be
|
|
3376
3084
|
used to delete it by calling clearstamp(stamp_id).
|
|
3377
3085
|
|
|
3378
|
-
Example (for a Turtle instance named turtle):
|
|
3379
|
-
>>> turtle.colour("blue")
|
|
3380
|
-
>>> turtle.stamp()
|
|
3381
|
-
13
|
|
3382
|
-
>>> turtle.fd(50)
|
|
3383
3086
|
"""
|
|
3384
3087
|
screen = self.screen
|
|
3385
3088
|
shape = screen._shapes[self.turtle.shapeIndex]
|
|
@@ -3439,11 +3142,6 @@ class RawTurtle(TPen, TNavigator):
|
|
|
3439
3142
|
Argument:
|
|
3440
3143
|
stampid - an integer, must be return value of previous stamp() call.
|
|
3441
3144
|
|
|
3442
|
-
Example (for a Turtle instance named turtle):
|
|
3443
|
-
>>> turtle.colour("blue")
|
|
3444
|
-
>>> astamp = turtle.stamp()
|
|
3445
|
-
>>> turtle.fd(50)
|
|
3446
|
-
>>> turtle.clearstamp(astamp)
|
|
3447
3145
|
"""
|
|
3448
3146
|
self._clearstamp(stampid)
|
|
3449
3147
|
self._update()
|
|
@@ -3458,13 +3156,6 @@ class RawTurtle(TPen, TNavigator):
|
|
|
3458
3156
|
else if n > 0 delete first n stamps
|
|
3459
3157
|
else if n < 0 delete last n stamps.
|
|
3460
3158
|
|
|
3461
|
-
Example (for a Turtle instance named turtle):
|
|
3462
|
-
>>> for i in range(8):
|
|
3463
|
-
... turtle.stamp(); turtle.fd(30)
|
|
3464
|
-
...
|
|
3465
|
-
>>> turtle.clearstamps(2)
|
|
3466
|
-
>>> turtle.clearstamps(-2)
|
|
3467
|
-
>>> turtle.clearstamps()
|
|
3468
3159
|
"""
|
|
3469
3160
|
if n is None:
|
|
3470
3161
|
toDelete = self.stampItems[:]
|
|
@@ -3633,12 +3324,6 @@ class RawTurtle(TPen, TNavigator):
|
|
|
3633
3324
|
|
|
3634
3325
|
No argument.
|
|
3635
3326
|
|
|
3636
|
-
Example (for a Turtle instance named turtle):
|
|
3637
|
-
>>> turtle.begin_fill()
|
|
3638
|
-
>>> if turtle.filling():
|
|
3639
|
-
... turtle.pensize(5)
|
|
3640
|
-
... else:
|
|
3641
|
-
... turtle.pensize(3)
|
|
3642
3327
|
"""
|
|
3643
3328
|
return isinstance(self._fillpath, list)
|
|
3644
3329
|
|
|
@@ -3647,11 +3332,6 @@ class RawTurtle(TPen, TNavigator):
|
|
|
3647
3332
|
|
|
3648
3333
|
No argument.
|
|
3649
3334
|
|
|
3650
|
-
Example (for a Turtle instance named turtle):
|
|
3651
|
-
>>> turtle.colour("black", "red")
|
|
3652
|
-
>>> turtle.begin_fill()
|
|
3653
|
-
>>> turtle.circle(60)
|
|
3654
|
-
>>> turtle.end_fill()
|
|
3655
3335
|
"""
|
|
3656
3336
|
if not self.filling():
|
|
3657
3337
|
self._fillitem = self.screen._createpoly()
|
|
@@ -3668,11 +3348,6 @@ class RawTurtle(TPen, TNavigator):
|
|
|
3668
3348
|
|
|
3669
3349
|
No argument.
|
|
3670
3350
|
|
|
3671
|
-
Example (for a Turtle instance named turtle):
|
|
3672
|
-
>>> turtle.colour("black", "red")
|
|
3673
|
-
>>> turtle.begin_fill()
|
|
3674
|
-
>>> turtle.circle(60)
|
|
3675
|
-
>>> turtle.end_fill()
|
|
3676
3351
|
"""
|
|
3677
3352
|
if self.filling():
|
|
3678
3353
|
if len(self._fillpath) > 2:
|
|
@@ -3693,9 +3368,6 @@ class RawTurtle(TPen, TNavigator):
|
|
|
3693
3368
|
Draw a circular dot with diameter size, using colour.
|
|
3694
3369
|
If size is not given, the maximum of pensize+4 and 2*pensize is used.
|
|
3695
3370
|
|
|
3696
|
-
Example (for a Turtle instance named turtle):
|
|
3697
|
-
>>> turtle.dot()
|
|
3698
|
-
>>> turtle.fd(50); turtle.dot(20, "blue"); turtle.fd(50)
|
|
3699
3371
|
"""
|
|
3700
3372
|
if not colour:
|
|
3701
3373
|
if isinstance(size, (str, tuple)):
|
|
@@ -3756,9 +3428,6 @@ class RawTurtle(TPen, TNavigator):
|
|
|
3756
3428
|
If move is True, the pen is moved to the bottom-right corner
|
|
3757
3429
|
of the text. By default, move is False.
|
|
3758
3430
|
|
|
3759
|
-
Example (for a Turtle instance named turtle):
|
|
3760
|
-
>>> turtle.write('Home = ', True, align="center")
|
|
3761
|
-
>>> turtle.write((0,0), True)
|
|
3762
3431
|
"""
|
|
3763
3432
|
if self.undobuffer:
|
|
3764
3433
|
self.undobuffer.push(["seq"])
|
|
@@ -3778,8 +3447,6 @@ class RawTurtle(TPen, TNavigator):
|
|
|
3778
3447
|
Start recording the vertices of a polygon. Current turtle position
|
|
3779
3448
|
is first point of polygon.
|
|
3780
3449
|
|
|
3781
|
-
Example (for a Turtle instance named turtle):
|
|
3782
|
-
>>> turtle.begin_poly()
|
|
3783
3450
|
"""
|
|
3784
3451
|
self._poly = [self._position]
|
|
3785
3452
|
self._creatingPoly = True
|
|
@@ -3792,8 +3459,6 @@ class RawTurtle(TPen, TNavigator):
|
|
|
3792
3459
|
Stop recording the vertices of a polygon. Current turtle position is
|
|
3793
3460
|
last point of polygon. This will be connected with the first point.
|
|
3794
3461
|
|
|
3795
|
-
Example (for a Turtle instance named turtle):
|
|
3796
|
-
>>> turtle.end_poly()
|
|
3797
3462
|
"""
|
|
3798
3463
|
self._creatingPoly = False
|
|
3799
3464
|
|
|
@@ -3802,9 +3467,6 @@ class RawTurtle(TPen, TNavigator):
|
|
|
3802
3467
|
|
|
3803
3468
|
No argument.
|
|
3804
3469
|
|
|
3805
|
-
Example (for a Turtle instance named turtle):
|
|
3806
|
-
>>> p = turtle.get_poly()
|
|
3807
|
-
>>> turtle.register_shape("myFavouriteShape", p)
|
|
3808
3470
|
"""
|
|
3809
3471
|
## check if there is any poly?
|
|
3810
3472
|
if self._poly is not None:
|
|
@@ -3818,11 +3480,6 @@ class RawTurtle(TPen, TNavigator):
|
|
|
3818
3480
|
Return the TurtleScreen object, the turtle is drawing on.
|
|
3819
3481
|
So TurtleScreen-methods can be called for that object.
|
|
3820
3482
|
|
|
3821
|
-
Example (for a Turtle instance named turtle):
|
|
3822
|
-
>>> ts = turtle.getscreen()
|
|
3823
|
-
>>> ts
|
|
3824
|
-
<turtle.TurtleScreen object at 0x0106B770>
|
|
3825
|
-
>>> ts.bgcolour("pink")
|
|
3826
3483
|
"""
|
|
3827
3484
|
return self.screen
|
|
3828
3485
|
|
|
@@ -3833,13 +3490,6 @@ class RawTurtle(TPen, TNavigator):
|
|
|
3833
3490
|
|
|
3834
3491
|
Only reasonable use: as a function to return the 'anonymous turtle':
|
|
3835
3492
|
|
|
3836
|
-
Example:
|
|
3837
|
-
>>> pet = getturtle()
|
|
3838
|
-
>>> pet.fd(50)
|
|
3839
|
-
>>> pet
|
|
3840
|
-
<turtle.Turtle object at 0x0187D810>
|
|
3841
|
-
>>> turtles()
|
|
3842
|
-
[<turtle.Turtle object at 0x0187D810>]
|
|
3843
3493
|
"""
|
|
3844
3494
|
return self
|
|
3845
3495
|
|
|
@@ -3865,13 +3515,6 @@ class RawTurtle(TPen, TNavigator):
|
|
|
3865
3515
|
add -- True or False. If True, new binding will be added, otherwise
|
|
3866
3516
|
it will replace a former binding.
|
|
3867
3517
|
|
|
3868
|
-
Example for the anonymous turtle, i. e. the procedural way:
|
|
3869
|
-
|
|
3870
|
-
>>> def turn(x, y):
|
|
3871
|
-
... left(360)
|
|
3872
|
-
...
|
|
3873
|
-
>>> onclick(turn) # Now clicking into the turtle will turn it.
|
|
3874
|
-
>>> onclick(None) # event-binding will be removed
|
|
3875
3518
|
"""
|
|
3876
3519
|
self.screen._onclick(self.turtle._item, fun, btn, add)
|
|
3877
3520
|
self._update()
|
|
@@ -3884,17 +3527,6 @@ class RawTurtle(TPen, TNavigator):
|
|
|
3884
3527
|
the coordinates of the clicked point on the canvas.
|
|
3885
3528
|
btn -- number of the mouse-button defaults to 1 (left mouse button).
|
|
3886
3529
|
|
|
3887
|
-
Example (for a MyTurtle instance named joe):
|
|
3888
|
-
>>> class MyTurtle(Turtle):
|
|
3889
|
-
... def glow(self,x,y):
|
|
3890
|
-
... self.fillcolour("red")
|
|
3891
|
-
... def unglow(self,x,y):
|
|
3892
|
-
... self.fillcolour("")
|
|
3893
|
-
...
|
|
3894
|
-
>>> joe = MyTurtle()
|
|
3895
|
-
>>> joe.onclick(joe.glow)
|
|
3896
|
-
>>> joe.onrelease(joe.unglow)
|
|
3897
|
-
|
|
3898
3530
|
Clicking on joe turns fillcolour red, unclicking turns it to
|
|
3899
3531
|
transparent.
|
|
3900
3532
|
"""
|
|
@@ -3912,9 +3544,6 @@ class RawTurtle(TPen, TNavigator):
|
|
|
3912
3544
|
Every sequence of mouse-move-events on a turtle is preceded by a
|
|
3913
3545
|
mouse-click event on that turtle.
|
|
3914
3546
|
|
|
3915
|
-
Example (for a Turtle instance named turtle):
|
|
3916
|
-
>>> turtle.ondrag(turtle.goto)
|
|
3917
|
-
|
|
3918
3547
|
Subsequently clicking and dragging a Turtle will move it
|
|
3919
3548
|
across the screen thereby producing handdrawings (if pen is
|
|
3920
3549
|
down).
|
|
@@ -3963,13 +3592,6 @@ class RawTurtle(TPen, TNavigator):
|
|
|
3963
3592
|
Number of available undo actions is determined by the size of
|
|
3964
3593
|
the undobuffer.
|
|
3965
3594
|
|
|
3966
|
-
Example (for a Turtle instance named turtle):
|
|
3967
|
-
>>> for i in range(4):
|
|
3968
|
-
... turtle.fd(50); turtle.lt(80)
|
|
3969
|
-
...
|
|
3970
|
-
>>> for i in range(8):
|
|
3971
|
-
... turtle.undo()
|
|
3972
|
-
...
|
|
3973
3595
|
"""
|
|
3974
3596
|
if self.undobuffer is None:
|
|
3975
3597
|
return
|
|
@@ -4041,14 +3663,6 @@ class _Screen(TurtleScreen):
|
|
|
4041
3663
|
edge of the screen, if negative from the bottom edge
|
|
4042
3664
|
Default, starty=None is to center window vertically.
|
|
4043
3665
|
|
|
4044
|
-
Examples (for a Screen instance named screen):
|
|
4045
|
-
>>> screen.setup (width=200, height=200, startx=0, starty=0)
|
|
4046
|
-
|
|
4047
|
-
sets window to 200x200 pixels, in upper left of screen
|
|
4048
|
-
|
|
4049
|
-
>>> screen.setup(width=.75, height=0.5, startx=None, starty=None)
|
|
4050
|
-
|
|
4051
|
-
sets window to 75% of screen by 50% of screen and centers
|
|
4052
3666
|
"""
|
|
4053
3667
|
if not hasattr(self._root, "set_geometry"):
|
|
4054
3668
|
return
|
|
@@ -4075,8 +3689,6 @@ class _Screen(TurtleScreen):
|
|
|
4075
3689
|
This is a method of Screen-class. Not available for TurtleScreen-
|
|
4076
3690
|
objects.
|
|
4077
3691
|
|
|
4078
|
-
Example (for a Screen instance named screen):
|
|
4079
|
-
>>> screen.title("Welcome to the turtle-zoo!")
|
|
4080
3692
|
"""
|
|
4081
3693
|
if _Screen._root is not None:
|
|
4082
3694
|
_Screen._root.title(titlestring)
|
|
@@ -4093,11 +3705,7 @@ class _Screen(TurtleScreen):
|
|
|
4093
3705
|
root.destroy()
|
|
4094
3706
|
|
|
4095
3707
|
def bye(self):
|
|
4096
|
-
|
|
4097
|
-
|
|
4098
|
-
Example (for a TurtleScreen instance named screen):
|
|
4099
|
-
>>> screen.bye()
|
|
4100
|
-
"""
|
|
3708
|
+
#Shut the turtlegraphics window.
|
|
4101
3709
|
self._destroy()
|
|
4102
3710
|
|
|
4103
3711
|
def exitonclick(self):
|
|
@@ -4114,10 +3722,6 @@ class _Screen(TurtleScreen):
|
|
|
4114
3722
|
|
|
4115
3723
|
This is a method of the Screen-class and not available for
|
|
4116
3724
|
TurtleScreen instances.
|
|
4117
|
-
|
|
4118
|
-
Example (for a Screen instance named screen):
|
|
4119
|
-
>>> screen.exitonclick()
|
|
4120
|
-
|
|
4121
3725
|
"""
|
|
4122
3726
|
def exitGracefully(x, y):
|
|
4123
3727
|
"""Screen.bye() with two dummy-parameters"""
|
{ducky_python_module-0.1.3 → ducky_python_module-0.1.5}/src/ducky_python_module.egg-info/PKG-INFO
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: ducky-python-module
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.5
|
|
4
4
|
Summary: Ducky Python module
|
|
5
5
|
Author: Tom
|
|
6
6
|
License: Creative Commons Attribution-NonCommercial 4.0 International Public
|
|
@@ -346,8 +346,15 @@ Dynamic: license-file
|
|
|
346
346
|
|
|
347
347
|
# Ducky-Python-Module
|
|
348
348
|
A collection of tools for python
|
|
349
|
-
Still in progress
|
|
349
|
+
Still in progress and will be releasing fully soon
|
|
350
350
|
Credit:
|
|
351
351
|
Turtle library has been used and modified. I did not make it and I did include the text from the original library explaining rights to the Turtle program which I am not allowed to remove.
|
|
352
352
|
Nltk has been imported but not modified.
|
|
353
|
-
|
|
353
|
+
Full import list:
|
|
354
|
+
import random, time, os, tkinter as TK, types, math, inspect, sys, requests, json, numpy, ast, logging
|
|
355
|
+
from os.path import isfile, split, join
|
|
356
|
+
from copy import deepcopy
|
|
357
|
+
from tkinter import simpledialog
|
|
358
|
+
from turtle import Turtle
|
|
359
|
+
from nltk.tokenize import word_tokenize
|
|
360
|
+
from nltk.stem import LancasterStemmer
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
# Ducky-Python-Module
|
|
2
|
-
A collection of tools for python
|
|
3
|
-
Still in progress but it will be releasing fully soon
|
|
4
|
-
Credit:
|
|
5
|
-
Turtle library has been used and modified. I did not make it and I did include the text from the original library explaining rights to the Turtle program which I am not allowed to remove.
|
|
6
|
-
Nltk has been imported but not modified.
|
|
7
|
-
And a few other libraries which I'll mention when this is complete
|
|
File without changes
|
|
File without changes
|
{ducky_python_module-0.1.3 → ducky_python_module-0.1.5}/src/ducky_python_module.egg-info/SOURCES.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|