TurtleExtension 2.1.0__tar.gz → 2.2.0__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.
- {turtleextension-2.1.0 → turtleextension-2.2.0}/PKG-INFO +1 -1
- {turtleextension-2.1.0 → turtleextension-2.2.0}/TurtleExtension.egg-info/PKG-INFO +1 -1
- {turtleextension-2.1.0 → turtleextension-2.2.0}/pyproject.toml +1 -1
- {turtleextension-2.1.0 → turtleextension-2.2.0}/turtle_extension/foundations/custom_turtle_shapes.pyi +9 -2
- {turtleextension-2.1.0 → turtleextension-2.2.0}/turtle_extension/foundations/global_functions.pyi +7 -1
- {turtleextension-2.1.0 → turtleextension-2.2.0}/turtle_extension/foundations/turtle_functions.pyi +4 -0
- {turtleextension-2.1.0 → turtleextension-2.2.0}/turtle_extension/turtle_heart/turtle_skeleton.pyi +48 -1
- {turtleextension-2.1.0 → turtleextension-2.2.0}/LICENSE +0 -0
- {turtleextension-2.1.0 → turtleextension-2.2.0}/README.md +0 -0
- {turtleextension-2.1.0 → turtleextension-2.2.0}/TurtleExtension.egg-info/SOURCES.txt +0 -0
- {turtleextension-2.1.0 → turtleextension-2.2.0}/TurtleExtension.egg-info/dependency_links.txt +0 -0
- {turtleextension-2.1.0 → turtleextension-2.2.0}/TurtleExtension.egg-info/requires.txt +0 -0
- {turtleextension-2.1.0 → turtleextension-2.2.0}/TurtleExtension.egg-info/top_level.txt +0 -0
- {turtleextension-2.1.0 → turtleextension-2.2.0}/setup.cfg +0 -0
- {turtleextension-2.1.0 → turtleextension-2.2.0}/turtle_extension/__init__.py +0 -0
- {turtleextension-2.1.0 → turtleextension-2.2.0}/turtle_extension/foundations/__init__.py +0 -0
- {turtleextension-2.1.0 → turtleextension-2.2.0}/turtle_extension/foundations/custom_turtle_shapes.py +0 -0
- {turtleextension-2.1.0 → turtleextension-2.2.0}/turtle_extension/foundations/global_functions.py +0 -0
- {turtleextension-2.1.0 → turtleextension-2.2.0}/turtle_extension/foundations/global_variables.py +0 -0
- {turtleextension-2.1.0 → turtleextension-2.2.0}/turtle_extension/foundations/global_variables.pyi +0 -0
- {turtleextension-2.1.0 → turtleextension-2.2.0}/turtle_extension/foundations/turtle_functions.py +0 -0
- {turtleextension-2.1.0 → turtleextension-2.2.0}/turtle_extension/turtle_heart/__init__.py +0 -0
- {turtleextension-2.1.0 → turtleextension-2.2.0}/turtle_extension/turtle_heart/turtle_skeleton.py +0 -0
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "TurtleExtension"
|
|
7
|
-
version = "2.
|
|
7
|
+
version = "2.2.0"
|
|
8
8
|
description = "A Python utility library providing turtle extensions on top of Python's original turtle feature."
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">= 3.14"
|
|
@@ -24,6 +24,7 @@ class UserShape:
|
|
|
24
24
|
def custom_circle() -> ReturnShapeType:
|
|
25
25
|
"""
|
|
26
26
|
Creates a custom circle turtle shape.
|
|
27
|
+
|
|
27
28
|
:return: the custom shape
|
|
28
29
|
"""
|
|
29
30
|
|
|
@@ -31,6 +32,7 @@ class UserShape:
|
|
|
31
32
|
def custom_square() -> ReturnShapeType:
|
|
32
33
|
"""
|
|
33
34
|
Creates a custom square turtle shape.
|
|
35
|
+
|
|
34
36
|
:return: the custom shape
|
|
35
37
|
"""
|
|
36
38
|
|
|
@@ -38,6 +40,7 @@ class UserShape:
|
|
|
38
40
|
def custom_triangle() -> ReturnShapeType:
|
|
39
41
|
"""
|
|
40
42
|
Creates a custom equilateral triangle turtle shape.
|
|
43
|
+
|
|
41
44
|
:return: the custom shape
|
|
42
45
|
"""
|
|
43
46
|
|
|
@@ -45,6 +48,7 @@ class UserShape:
|
|
|
45
48
|
def custom_poly() -> ReturnShapeType:
|
|
46
49
|
"""
|
|
47
50
|
Creates a custom regular polygon turtle shape.
|
|
51
|
+
|
|
48
52
|
:return: the custom shape
|
|
49
53
|
"""
|
|
50
54
|
|
|
@@ -52,19 +56,22 @@ class UserShape:
|
|
|
52
56
|
def custom_SOD() -> ReturnShapeType:
|
|
53
57
|
"""
|
|
54
58
|
Creates a custom star of David turtle shape.
|
|
59
|
+
|
|
55
60
|
:return: the custom shape
|
|
56
61
|
"""
|
|
57
62
|
|
|
58
63
|
@classmethod
|
|
59
64
|
def list_shapes(cls) -> UserShapeDictType:
|
|
60
65
|
"""
|
|
61
|
-
Creates a dictionary with the functions in UserShape and returns it
|
|
66
|
+
Creates a dictionary with the functions in UserShape and returns it.
|
|
67
|
+
|
|
62
68
|
:return: dictionary containing function names -> function
|
|
63
69
|
"""
|
|
64
70
|
|
|
65
71
|
def get_UserShape_dict() -> UserShapeDictType:
|
|
66
72
|
"""
|
|
67
|
-
Takes all custom turtle functions in UserShape and returns a dictionary with them
|
|
73
|
+
Takes all custom turtle functions in UserShape and returns a dictionary with them.
|
|
74
|
+
|
|
68
75
|
:return: dictionary mapping function names to functions
|
|
69
76
|
"""
|
|
70
77
|
|
{turtleextension-2.1.0 → turtleextension-2.2.0}/turtle_extension/foundations/global_functions.pyi
RENAMED
|
@@ -9,31 +9,36 @@ from ..turtle_heart import ChainTurtle, tl
|
|
|
9
9
|
def get_screen() -> tl.Screen:
|
|
10
10
|
"""
|
|
11
11
|
Initiates the turtle screen when the function is called.
|
|
12
|
+
|
|
12
13
|
:return: turtle screen object
|
|
13
14
|
"""
|
|
14
15
|
|
|
15
16
|
def SU() -> None:
|
|
16
17
|
"""
|
|
17
18
|
This function updates the turtle screen.
|
|
19
|
+
|
|
18
20
|
:return: None
|
|
19
21
|
"""
|
|
20
22
|
|
|
21
23
|
def mainloop() -> None:
|
|
22
24
|
"""
|
|
23
25
|
This function keeps the turtle screen open.
|
|
26
|
+
|
|
24
27
|
:return: None
|
|
25
28
|
"""
|
|
26
29
|
|
|
27
30
|
type TurtleListType = list[ChainTurtle]
|
|
28
31
|
|
|
29
32
|
def tls_color(**options) -> int | tuple[TurtleListType, int] | TurtleListType | None:
|
|
30
|
-
"""
|
|
33
|
+
"""
|
|
34
|
+
This function creates a turtle list with their colors or adds newly creates turtles to the UV["tls"] list
|
|
31
35
|
to be used for the user_drawing_ft()
|
|
32
36
|
|
|
33
37
|
USERS NOTICE: it is HIGHLY recommended to NOT enter a turtles count of MORE than a few hundred (max. 200) unless required!!!
|
|
34
38
|
|
|
35
39
|
:param options: tl_num -> number of turtles to create, entry -> input string, index -> number of turtles to be created for user_drawing_ft()
|
|
36
40
|
& it returns the index of the last turtle
|
|
41
|
+
|
|
37
42
|
:return: tls_num: turtle list with colored turtles, entry: list with colored turtles + number of turtles ,otherwise: index of last turtle
|
|
38
43
|
"""
|
|
39
44
|
|
|
@@ -42,6 +47,7 @@ def reset_tls(tls_list: TurtleListType) -> list:
|
|
|
42
47
|
This function deletes the drawings of given turtle list + turtles
|
|
43
48
|
|
|
44
49
|
>>> tls = [ChainTurtle(), ChainTurtle()]
|
|
50
|
+
|
|
45
51
|
>>> reset_tls(tls)
|
|
46
52
|
[]
|
|
47
53
|
|
{turtleextension-2.1.0 → turtleextension-2.2.0}/turtle_extension/foundations/turtle_functions.pyi
RENAMED
|
@@ -13,7 +13,9 @@ class TurtleFct:
|
|
|
13
13
|
def change_shape(cls, tls_num: ChainTurtle|None = None) -> ChainTurtle | str:
|
|
14
14
|
"""
|
|
15
15
|
This function lets the user choose different turtles shapes, including a custom option.
|
|
16
|
+
|
|
16
17
|
:param tls_num: ChainTurtle() or None
|
|
18
|
+
|
|
17
19
|
:return: ChainTurtle() if tls_num is a ChainTurtle(), otherwise None
|
|
18
20
|
"""
|
|
19
21
|
|
|
@@ -21,6 +23,8 @@ class TurtleFct:
|
|
|
21
23
|
def user_tls_shape_ft(tls_num: ChainTurtle | None = None) -> ChainTurtle | str:
|
|
22
24
|
"""
|
|
23
25
|
This function lets the user create custom turtle shapes.
|
|
26
|
+
|
|
24
27
|
:param tls_num: ChainTurtle() or None
|
|
28
|
+
|
|
25
29
|
:return: ChainTurtle() if tls_num is a ChainTurtle(), otherwise None
|
|
26
30
|
"""
|
{turtleextension-2.1.0 → turtleextension-2.2.0}/turtle_extension/turtle_heart/turtle_skeleton.pyi
RENAMED
|
@@ -9,97 +9,123 @@ from numbers import Real
|
|
|
9
9
|
tl = tl
|
|
10
10
|
|
|
11
11
|
class ChainTurtle:
|
|
12
|
-
"""
|
|
12
|
+
"""
|
|
13
|
+
This class adds chaining functionality to turtle.Turtle
|
|
14
|
+
|
|
15
|
+
"""
|
|
13
16
|
def fd(self, distance: Real) -> ChainTurtle:
|
|
14
17
|
"""
|
|
15
18
|
Makes the turtle go forward with trace.
|
|
19
|
+
|
|
16
20
|
:param distance: distance in pixels
|
|
21
|
+
|
|
17
22
|
:return: ChainTurtle()
|
|
18
23
|
"""
|
|
19
24
|
|
|
20
25
|
def fd_inv(self, distance: Real) -> ChainTurtle:
|
|
21
26
|
"""
|
|
22
27
|
Makes the turtle go forward with no trace.
|
|
28
|
+
|
|
23
29
|
:param distance: distance in pixels
|
|
30
|
+
|
|
24
31
|
:return: ChainTurtle()
|
|
25
32
|
"""
|
|
26
33
|
|
|
27
34
|
def bk(self, distance: Real) -> ChainTurtle:
|
|
28
35
|
"""
|
|
29
36
|
Makes the turtle go backwards with trace.
|
|
37
|
+
|
|
30
38
|
:param distance: distance in pixels
|
|
39
|
+
|
|
31
40
|
:return: ChainTurtle()
|
|
32
41
|
"""
|
|
33
42
|
|
|
34
43
|
def bk_inv(self, distance: Real) -> ChainTurtle:
|
|
35
44
|
"""
|
|
36
45
|
Makes the turtle go backward with no trace.
|
|
46
|
+
|
|
37
47
|
:param distance: distance in pixels
|
|
48
|
+
|
|
38
49
|
:return: ChainTurtle()
|
|
39
50
|
"""
|
|
40
51
|
|
|
41
52
|
def rt(self, angle: Real) -> ChainTurtle:
|
|
42
53
|
"""
|
|
43
54
|
Makes the turtle turn right.
|
|
55
|
+
|
|
44
56
|
:param angle: angle in degrees
|
|
57
|
+
|
|
45
58
|
:return: ChainTurtle()
|
|
46
59
|
"""
|
|
47
60
|
|
|
48
61
|
def lt(self, angle: Real) -> ChainTurtle:
|
|
49
62
|
"""
|
|
50
63
|
Makes the turtle turn left.
|
|
64
|
+
|
|
51
65
|
:param angle: angle in degrees
|
|
66
|
+
|
|
52
67
|
:return: ChainTurtle()
|
|
53
68
|
"""
|
|
54
69
|
|
|
55
70
|
def setpos(self, x_val: Real, y_val: Real) -> ChainTurtle:
|
|
56
71
|
"""
|
|
57
72
|
Makes the turtle go to a specific position with a trace.
|
|
73
|
+
|
|
58
74
|
:param x_val: x position in pixels
|
|
75
|
+
|
|
59
76
|
:param y_val: y position in pixels
|
|
77
|
+
|
|
60
78
|
:return: ChainTurtle()
|
|
61
79
|
"""
|
|
62
80
|
|
|
63
81
|
def pu(self) -> ChainTurtle:
|
|
64
82
|
"""
|
|
65
83
|
Puts the pen down to leave a trace.
|
|
84
|
+
|
|
66
85
|
:return: ChainTurtle()
|
|
67
86
|
"""
|
|
68
87
|
|
|
69
88
|
def pd(self) -> ChainTurtle:
|
|
70
89
|
"""
|
|
71
90
|
Puts the pen up to not leave a trace.
|
|
91
|
+
|
|
72
92
|
:return: ChainTurtle()
|
|
73
93
|
"""
|
|
74
94
|
|
|
75
95
|
def seth(self, direction: Real) -> ChainTurtle:
|
|
76
96
|
"""
|
|
77
97
|
Sets the direction of the turtle starting East, going counterclockwise.
|
|
98
|
+
|
|
78
99
|
:param direction: direction in degrees
|
|
100
|
+
|
|
79
101
|
:return: ChainTurtle()
|
|
80
102
|
"""
|
|
81
103
|
|
|
82
104
|
def home(self) -> ChainTurtle:
|
|
83
105
|
"""
|
|
84
106
|
Sets the position of the turtle to home (0, 0) with trace, heading = 0 .
|
|
107
|
+
|
|
85
108
|
:return: ChainTurtle()
|
|
86
109
|
"""
|
|
87
110
|
|
|
88
111
|
def home_inv(self) -> ChainTurtle:
|
|
89
112
|
"""
|
|
90
113
|
Sets the position of the turtle to home (0, 0) without trace, heading = 0 .
|
|
114
|
+
|
|
91
115
|
:return: ChainTurtle()
|
|
92
116
|
"""
|
|
93
117
|
|
|
94
118
|
def begin_fill(self) -> ChainTurtle:
|
|
95
119
|
"""
|
|
96
120
|
Makes the turtle begin fill for a closed shape.
|
|
121
|
+
|
|
97
122
|
:return: ChainTurtle()
|
|
98
123
|
"""
|
|
99
124
|
|
|
100
125
|
def end_fill(self) -> ChainTurtle:
|
|
101
126
|
"""
|
|
102
127
|
Ends the turtle fill for a closed shape, therefore fills the shapes.
|
|
128
|
+
|
|
103
129
|
:return: ChainTurtle()
|
|
104
130
|
"""
|
|
105
131
|
|
|
@@ -109,9 +135,13 @@ class ChainTurtle:
|
|
|
109
135
|
steps: int | None = None) -> ChainTurtle:
|
|
110
136
|
"""
|
|
111
137
|
Makes the turtle draw a circle
|
|
138
|
+
|
|
112
139
|
:param radius: radius in pixels
|
|
140
|
+
|
|
113
141
|
:param extent: extent in degrees
|
|
142
|
+
|
|
114
143
|
:param steps: number of sides
|
|
144
|
+
|
|
115
145
|
:return: ChainTurtle()
|
|
116
146
|
"""
|
|
117
147
|
|
|
@@ -121,56 +151,72 @@ class ChainTurtle:
|
|
|
121
151
|
sides: int | None = None) -> ChainTurtle:
|
|
122
152
|
"""
|
|
123
153
|
Makes the turtle draw a circle and fills it
|
|
154
|
+
|
|
124
155
|
:param radius: radius in degrees
|
|
156
|
+
|
|
125
157
|
:param angle: angle in degrees
|
|
158
|
+
|
|
126
159
|
:param sides: number of sides
|
|
160
|
+
|
|
127
161
|
:return: ChainTurtle()
|
|
128
162
|
"""
|
|
129
163
|
|
|
130
164
|
def dot(self, radius: Real) -> ChainTurtle:
|
|
131
165
|
"""
|
|
132
166
|
Makes the turtle draw a colored dot
|
|
167
|
+
|
|
133
168
|
:param radius: radius in pixels
|
|
169
|
+
|
|
134
170
|
:return: ChainTurtle()
|
|
135
171
|
"""
|
|
136
172
|
|
|
137
173
|
def color(self, turtle_color: str) -> ChainTurtle:
|
|
138
174
|
"""
|
|
139
175
|
Lets the user change the color of the turtle trace and turtle color itself
|
|
176
|
+
|
|
140
177
|
:param turtle_color: valid turtle color
|
|
178
|
+
|
|
141
179
|
:return: ChainTurtle()
|
|
142
180
|
"""
|
|
143
181
|
|
|
144
182
|
def teleport(self, x: Real, y: Real, *, fill_gap: bool = False) -> ChainTurtle:
|
|
145
183
|
"""
|
|
146
184
|
Makes the turtle to go a specific coordinate with no trace
|
|
185
|
+
|
|
147
186
|
:param x: x position in pixels
|
|
187
|
+
|
|
148
188
|
:param y: y position in pixels
|
|
189
|
+
|
|
149
190
|
:return: ChainTurtle()
|
|
150
191
|
"""
|
|
151
192
|
|
|
152
193
|
def shape(self, shape_name: str) -> ChainTurtle:
|
|
153
194
|
"""
|
|
154
195
|
Changes the shape of the turtle shape
|
|
196
|
+
|
|
155
197
|
:param shape_name: name of the shape
|
|
198
|
+
|
|
156
199
|
:return: ChainTurtle()
|
|
157
200
|
"""
|
|
158
201
|
|
|
159
202
|
def undo(self) -> ChainTurtle:
|
|
160
203
|
"""
|
|
161
204
|
Undoes the last turtle command.
|
|
205
|
+
|
|
162
206
|
:return: ChainTurtle()
|
|
163
207
|
"""
|
|
164
208
|
|
|
165
209
|
def clear(self) -> ChainTurtle:
|
|
166
210
|
"""
|
|
167
211
|
Deletes the turtles drawings.
|
|
212
|
+
|
|
168
213
|
:return: ChainTurtle()
|
|
169
214
|
"""
|
|
170
215
|
|
|
171
216
|
def ht(self) -> ChainTurtle:
|
|
172
217
|
"""
|
|
173
218
|
Hides the turtle.
|
|
219
|
+
|
|
174
220
|
:return: ChainTurtle()
|
|
175
221
|
"""
|
|
176
222
|
|
|
@@ -178,5 +224,6 @@ class ChainTurtle:
|
|
|
178
224
|
def list_methods(cls) -> dict[str, Callable]:
|
|
179
225
|
"""
|
|
180
226
|
Creates a dictionary with all ChainTurtle methods and returns it
|
|
227
|
+
|
|
181
228
|
:return: dictionary
|
|
182
229
|
"""
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{turtleextension-2.1.0 → turtleextension-2.2.0}/TurtleExtension.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{turtleextension-2.1.0 → turtleextension-2.2.0}/turtle_extension/foundations/custom_turtle_shapes.py
RENAMED
|
File without changes
|
{turtleextension-2.1.0 → turtleextension-2.2.0}/turtle_extension/foundations/global_functions.py
RENAMED
|
File without changes
|
{turtleextension-2.1.0 → turtleextension-2.2.0}/turtle_extension/foundations/global_variables.py
RENAMED
|
File without changes
|
{turtleextension-2.1.0 → turtleextension-2.2.0}/turtle_extension/foundations/global_variables.pyi
RENAMED
|
File without changes
|
{turtleextension-2.1.0 → turtleextension-2.2.0}/turtle_extension/foundations/turtle_functions.py
RENAMED
|
File without changes
|
|
File without changes
|
{turtleextension-2.1.0 → turtleextension-2.2.0}/turtle_extension/turtle_heart/turtle_skeleton.py
RENAMED
|
File without changes
|