superturtle 1.2.1__tar.gz → 1.3.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.
- {superturtle-1.2.1 → superturtle-1.3.0}/PKG-INFO +5 -14
- superturtle-1.3.0/pyproject.toml +25 -0
- superturtle-1.3.0/src/superturtle/__init__.py +1 -0
- {superturtle-1.2.1 → superturtle-1.3.0/src}/superturtle/image.py +21 -14
- superturtle-1.3.0/src/superturtle/svg.py +317 -0
- superturtle-1.2.1/pyproject.toml +0 -31
- superturtle-1.2.1/superturtle/__init__.py +0 -1
- {superturtle-1.2.1 → superturtle-1.3.0}/README.md +0 -0
- {superturtle-1.2.1 → superturtle-1.3.0/src}/superturtle/animation.py +0 -0
- {superturtle-1.2.1 → superturtle-1.3.0/src}/superturtle/easing.py +0 -0
- {superturtle-1.2.1 → superturtle-1.3.0/src}/superturtle/fancy_drawing.py +0 -0
- {superturtle-1.2.1 → superturtle-1.3.0/src}/superturtle/movement.py +0 -0
- {superturtle-1.2.1 → superturtle-1.3.0/src}/superturtle/stroke.py +0 -0
- {superturtle-1.2.1 → superturtle-1.3.0/src}/superturtle/test.py +0 -0
|
@@ -1,19 +1,11 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.3
|
|
2
2
|
Name: superturtle
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.3.0
|
|
4
4
|
Summary: Extensions to Python's turtle
|
|
5
|
-
License: MIT
|
|
6
5
|
Author: Chris Proctor
|
|
7
|
-
Author-email: chris@chrisproctor.net
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
Classifier: Programming Language :: Python :: 3
|
|
11
|
-
Classifier: Programming Language :: Python :: 3.10
|
|
12
|
-
Classifier: Programming Language :: Python :: 3.11
|
|
13
|
-
Classifier: Programming Language :: Python :: 3.12
|
|
14
|
-
Classifier: Programming Language :: Python :: 3.13
|
|
15
|
-
Classifier: Programming Language :: Python :: 3.14
|
|
16
|
-
Requires-Dist: svg-turtle (>=1.0.0,<2.0.0)
|
|
6
|
+
Author-email: Chris Proctor <chris@chrisproctor.net>
|
|
7
|
+
License: MIT
|
|
8
|
+
Requires-Python: >=3.10, <4.0
|
|
17
9
|
Description-Content-Type: text/markdown
|
|
18
10
|
|
|
19
11
|
# Superturtle
|
|
@@ -51,4 +43,3 @@ early in a CS curriculum, but they fit naturally with other constructs which con
|
|
|
51
43
|
code blocks: loops, conditionals, and function definition. We hypothesize that introducing
|
|
52
44
|
intuitive context managers with easy-to-visualize effects may reinforce the more abstract
|
|
53
45
|
role of control structures, and may support students in learning to read indented Python code.
|
|
54
|
-
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "superturtle"
|
|
3
|
+
version = "1.3.0"
|
|
4
|
+
description = "Extensions to Python's turtle"
|
|
5
|
+
authors = [
|
|
6
|
+
{name="Chris Proctor", email="chris@chrisproctor.net"}
|
|
7
|
+
]
|
|
8
|
+
license = {text = "MIT"}
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
documentation = "https://docs.makingwithcode.org/superturtle"
|
|
11
|
+
requires-python = ">=3.10,<4.0"
|
|
12
|
+
dependencies = []
|
|
13
|
+
|
|
14
|
+
[dependency-groups]
|
|
15
|
+
docs = [
|
|
16
|
+
"sphinx>=7.0.1,<8",
|
|
17
|
+
"furo>=2023.5.20",
|
|
18
|
+
]
|
|
19
|
+
dev = [
|
|
20
|
+
"pytest>=5.2",
|
|
21
|
+
]
|
|
22
|
+
|
|
23
|
+
[build-system]
|
|
24
|
+
requires = ["uv_build>=0.11.4,<0.12.0"]
|
|
25
|
+
build-backend = "uv_build"
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = '1.3.0'
|
|
@@ -6,12 +6,12 @@
|
|
|
6
6
|
from turtle import getcanvas, Turtle
|
|
7
7
|
from pathlib import Path
|
|
8
8
|
from subprocess import run
|
|
9
|
-
from
|
|
9
|
+
from superturtle.svg import SVGTurtle
|
|
10
10
|
|
|
11
11
|
def save(filename):
|
|
12
12
|
"""
|
|
13
13
|
Saves the canvas as a raster-based image, comparable to taking a screenshot.
|
|
14
|
-
Suitable file extensions include .png and .jpg.
|
|
14
|
+
Suitable file extensions include .png and .jpg.
|
|
15
15
|
|
|
16
16
|
Arguments:
|
|
17
17
|
filename (str): Location to save the file, including file extension.
|
|
@@ -29,16 +29,16 @@ class save_svg:
|
|
|
29
29
|
not draw on the screen. You can use `dryrun=True` to draw to the screen instead
|
|
30
30
|
of to the SVG file while you develop your drawing.
|
|
31
31
|
|
|
32
|
-
The specified width and height define the SVG's viewBox, centered on
|
|
33
|
-
(0, 0). Anything outside of this area will be cut off.
|
|
34
|
-
If you are planning to draw the resulting SVG with a pen plotter,
|
|
32
|
+
The specified width and height define the SVG's viewBox, centered on
|
|
33
|
+
(0, 0). Anything outside of this area will be cut off.
|
|
34
|
+
If you are planning to draw the resulting SVG with a pen plotter,
|
|
35
35
|
keep in mind that 1 inch == 96 pixels. A standard sheet of paper (8.5" by 11")
|
|
36
|
-
is 816 px by 1056 px.
|
|
36
|
+
is 816 px by 1056 px.
|
|
37
37
|
|
|
38
|
-
It can helpful to set the turtle's canvas to the same size as your drawing
|
|
38
|
+
It can helpful to set the turtle's canvas to the same size as your drawing
|
|
39
39
|
so that you can see how your drawing fits on the page. To do this, use turtle's
|
|
40
|
-
`setup(width, height)` function to set the window size and
|
|
41
|
-
`screensize(width, height)` function to set the canvas size. It helps to add a
|
|
40
|
+
`setup(width, height)` function to set the window size and
|
|
41
|
+
`screensize(width, height)` function to set the canvas size. It helps to add a
|
|
42
42
|
couple of extra pixels to the window size to avoid getting scroll bars.
|
|
43
43
|
|
|
44
44
|
Arguments:
|
|
@@ -46,6 +46,9 @@ class save_svg:
|
|
|
46
46
|
height (int): Height of resulting SVG file in pixels.
|
|
47
47
|
filename (str): Location to save resulting SVG.
|
|
48
48
|
dryrun (bool): (Optional) Disable saving to SVG and draw to the screen instead.
|
|
49
|
+
group_colors (bool): (Optional) Group strokes by color in the SVG output,
|
|
50
|
+
which makes color-based layer workflows in Inkscape and vpype easier.
|
|
51
|
+
Defaults to True. Set to False to preserve strict draw order.
|
|
49
52
|
|
|
50
53
|
::
|
|
51
54
|
|
|
@@ -59,15 +62,19 @@ class save_svg:
|
|
|
59
62
|
with save_svg(width, height, "image.svg"):
|
|
60
63
|
circle(100)
|
|
61
64
|
"""
|
|
62
|
-
def __init__(self, width, height, filename, dryrun=False):
|
|
65
|
+
def __init__(self, width, height, filename, dryrun=False, group_colors=True):
|
|
63
66
|
self.dryrun = dryrun
|
|
64
|
-
self.svg_turtle = SvgTurtle(width, height)
|
|
65
67
|
self.filename = filename
|
|
68
|
+
self.group_colors = group_colors
|
|
69
|
+
if not dryrun:
|
|
70
|
+
self._svg_turtle = SVGTurtle(width, height)
|
|
71
|
+
|
|
66
72
|
def __enter__(self):
|
|
67
73
|
if not self.dryrun:
|
|
68
|
-
Turtle._pen = self.
|
|
74
|
+
Turtle._pen = self._svg_turtle
|
|
75
|
+
return self
|
|
76
|
+
|
|
69
77
|
def __exit__(self, type, value, traceback):
|
|
70
78
|
if not self.dryrun:
|
|
71
|
-
self.
|
|
79
|
+
self._svg_turtle.save_as(self.filename, group_colors=self.group_colors)
|
|
72
80
|
Turtle._pen = None
|
|
73
|
-
|
|
@@ -0,0 +1,317 @@
|
|
|
1
|
+
import re
|
|
2
|
+
from collections import defaultdict
|
|
3
|
+
from dataclasses import dataclass, field
|
|
4
|
+
|
|
5
|
+
try:
|
|
6
|
+
import tkinter as tk
|
|
7
|
+
except ImportError as e:
|
|
8
|
+
raise ImportError(
|
|
9
|
+
"superturtle's SVG export requires tkinter. "
|
|
10
|
+
"On macOS with Homebrew Python, install it with: "
|
|
11
|
+
"brew install python-tk@X.Y (replace X.Y with your Python version)"
|
|
12
|
+
) from e
|
|
13
|
+
|
|
14
|
+
from turtle import RawTurtle, TurtleScreen, TurtleGraphicsError
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class _DummyWindow:
|
|
18
|
+
def call(self, *args, **kwargs):
|
|
19
|
+
pass
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
@dataclass
|
|
23
|
+
class _CanvasItem:
|
|
24
|
+
method: str
|
|
25
|
+
coords: tuple
|
|
26
|
+
attribs: dict
|
|
27
|
+
z_order: int
|
|
28
|
+
deleted: bool = False
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
class SVGCanvas:
|
|
32
|
+
"""Fake Tk canvas that records drawing commands for SVG export."""
|
|
33
|
+
|
|
34
|
+
def __init__(self, width: int, height: int):
|
|
35
|
+
self._opts = {'width': int(round(width)), 'height': int(round(height)), 'bg': 'white'}
|
|
36
|
+
self._items: list[_CanvasItem] = []
|
|
37
|
+
|
|
38
|
+
# --- option accessors (TurtleScreenBase reads width/height via cget) ---
|
|
39
|
+
|
|
40
|
+
def cget(self, key):
|
|
41
|
+
val = self._opts.get(key, '')
|
|
42
|
+
# Tkinter returns scrollregion as a space-separated string
|
|
43
|
+
if key == 'scrollregion' and isinstance(val, (tuple, list)):
|
|
44
|
+
return ' '.join(str(v) for v in val)
|
|
45
|
+
return val
|
|
46
|
+
|
|
47
|
+
def __getitem__(self, key):
|
|
48
|
+
return self.cget(key)
|
|
49
|
+
|
|
50
|
+
def config(self, **kwargs):
|
|
51
|
+
self._opts.update(kwargs)
|
|
52
|
+
|
|
53
|
+
configure = config
|
|
54
|
+
|
|
55
|
+
# --- dimensions ---
|
|
56
|
+
|
|
57
|
+
def winfo_width(self) -> int:
|
|
58
|
+
return self._opts['width']
|
|
59
|
+
|
|
60
|
+
def winfo_height(self) -> int:
|
|
61
|
+
return self._opts['height']
|
|
62
|
+
|
|
63
|
+
@staticmethod
|
|
64
|
+
def winfo_toplevel():
|
|
65
|
+
return _DummyWindow()
|
|
66
|
+
|
|
67
|
+
# --- item creation ---
|
|
68
|
+
|
|
69
|
+
def create_line(self, *coords, **opts):
|
|
70
|
+
return self._add('line', coords, opts)
|
|
71
|
+
|
|
72
|
+
def create_polygon(self, coords, **opts):
|
|
73
|
+
# turtle.py passes coords as a single flat sequence
|
|
74
|
+
return self._add('polygon', tuple(coords), opts)
|
|
75
|
+
|
|
76
|
+
def create_text(self, x, y, **opts):
|
|
77
|
+
return self._add('text', (x, y), opts)
|
|
78
|
+
|
|
79
|
+
def create_image(self, *args, **opts):
|
|
80
|
+
return self._add('image', args, opts)
|
|
81
|
+
|
|
82
|
+
def _add(self, method, coords, attribs):
|
|
83
|
+
item_id = len(self._items)
|
|
84
|
+
self._items.append(_CanvasItem(method, coords, dict(attribs), item_id))
|
|
85
|
+
return item_id
|
|
86
|
+
|
|
87
|
+
# --- item management ---
|
|
88
|
+
|
|
89
|
+
def coords(self, item_id, *new_coords):
|
|
90
|
+
if new_coords:
|
|
91
|
+
self._items[item_id].coords = new_coords
|
|
92
|
+
else:
|
|
93
|
+
return list(self._items[item_id].coords)
|
|
94
|
+
|
|
95
|
+
def itemconfigure(self, item_id, **kwargs):
|
|
96
|
+
self._items[item_id].attribs.update(kwargs)
|
|
97
|
+
|
|
98
|
+
itemconfig = itemconfigure
|
|
99
|
+
|
|
100
|
+
def itemcget(self, item_id, key):
|
|
101
|
+
return self._items[item_id].attribs.get(key, '')
|
|
102
|
+
|
|
103
|
+
def tag_raise(self, item_id):
|
|
104
|
+
if self._items:
|
|
105
|
+
self._items[item_id].z_order = max(i.z_order for i in self._items) + 1
|
|
106
|
+
|
|
107
|
+
def delete(self, target):
|
|
108
|
+
if target == 'all':
|
|
109
|
+
for item in self._items:
|
|
110
|
+
item.deleted = True
|
|
111
|
+
elif isinstance(target, int):
|
|
112
|
+
self._items[target].deleted = True
|
|
113
|
+
|
|
114
|
+
def find_all(self):
|
|
115
|
+
return range(len(self._items))
|
|
116
|
+
|
|
117
|
+
def bbox(self, item_id):
|
|
118
|
+
coords = self._items[item_id].coords
|
|
119
|
+
if coords:
|
|
120
|
+
return coords[0], coords[1], coords[0], coords[1]
|
|
121
|
+
return 0, 0, 0, 0
|
|
122
|
+
|
|
123
|
+
def type(self, item_id):
|
|
124
|
+
return self._items[item_id].method
|
|
125
|
+
|
|
126
|
+
# --- no-ops (event binding, display refresh) ---
|
|
127
|
+
|
|
128
|
+
def update(self): pass
|
|
129
|
+
def after(self, *args, **kwargs): pass
|
|
130
|
+
def focus_force(self): pass
|
|
131
|
+
def bind(self, *args, **kwargs): pass
|
|
132
|
+
def unbind(self, *args, **kwargs): pass
|
|
133
|
+
def tag_bind(self, *args, **kwargs): pass
|
|
134
|
+
def tag_unbind(self, *args, **kwargs): pass
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
class SVGScreen(TurtleScreen):
|
|
138
|
+
"""TurtleScreen backed by SVGCanvas instead of a real Tk window."""
|
|
139
|
+
|
|
140
|
+
def __init__(self, canvas: SVGCanvas):
|
|
141
|
+
# Create a hidden Tk root before super().__init__ so that:
|
|
142
|
+
# - _blankimage() can return a real PhotoImage (satisfies Python 3.14's
|
|
143
|
+
# isinstance assertion in Shape.__init__ without any monkey-patching)
|
|
144
|
+
# - _colorstr() can resolve color names via winfo_rgb
|
|
145
|
+
self._tk_root = tk.Tk()
|
|
146
|
+
self._tk_root.withdraw()
|
|
147
|
+
super().__init__(canvas)
|
|
148
|
+
|
|
149
|
+
def _blankimage(self):
|
|
150
|
+
return tk.PhotoImage(width=1, height=1, master=self._tk_root)
|
|
151
|
+
|
|
152
|
+
def _colorstr(self, color):
|
|
153
|
+
if len(color) == 1:
|
|
154
|
+
color = color[0]
|
|
155
|
+
if isinstance(color, str):
|
|
156
|
+
if re.match(r'^#[0-9A-Fa-f]{6}$', color):
|
|
157
|
+
return color.lower()
|
|
158
|
+
try:
|
|
159
|
+
r16, g16, b16 = self._tk_root.winfo_rgb(color)
|
|
160
|
+
return '#%02x%02x%02x' % (r16 >> 8, g16 >> 8, b16 >> 8)
|
|
161
|
+
except tk.TclError:
|
|
162
|
+
raise TurtleGraphicsError(f'bad color string: {color!r}')
|
|
163
|
+
try:
|
|
164
|
+
r, g, b = color
|
|
165
|
+
except (TypeError, ValueError):
|
|
166
|
+
raise TurtleGraphicsError(f'bad color arguments: {color!r}')
|
|
167
|
+
colormode = self._colormode
|
|
168
|
+
r, g, b = [round(255.0 * x / colormode) for x in (r, g, b)]
|
|
169
|
+
if not (0 <= r <= 255 and 0 <= g <= 255 and 0 <= b <= 255):
|
|
170
|
+
raise TurtleGraphicsError(f'bad color sequence: {color!r}')
|
|
171
|
+
return '#%02x%02x%02x' % (r, g, b)
|
|
172
|
+
|
|
173
|
+
def _iscolorstring(self, color):
|
|
174
|
+
try:
|
|
175
|
+
self._tk_root.winfo_rgb(color)
|
|
176
|
+
return True
|
|
177
|
+
except tk.TclError:
|
|
178
|
+
return False
|
|
179
|
+
|
|
180
|
+
def _color(self, colorstr):
|
|
181
|
+
# Colors are stored as hex strings; return as-is
|
|
182
|
+
return colorstr
|
|
183
|
+
|
|
184
|
+
# --- Tk stubs ---
|
|
185
|
+
|
|
186
|
+
def title(self, title): pass
|
|
187
|
+
def setup(self, *args, **kwargs): pass
|
|
188
|
+
def textinput(self, title, prompt): return None
|
|
189
|
+
def numinput(self, title, prompt, default=None, minval=None, maxval=None): return None
|
|
190
|
+
def mainloop(self): pass
|
|
191
|
+
def done(self): pass
|
|
192
|
+
def bye(self): pass
|
|
193
|
+
def exitonclick(self): pass
|
|
194
|
+
|
|
195
|
+
|
|
196
|
+
class SVGTurtle(RawTurtle):
|
|
197
|
+
"""RawTurtle that draws to an SVGCanvas instead of a real Tk window."""
|
|
198
|
+
|
|
199
|
+
def __init__(self, width: int, height: int):
|
|
200
|
+
canvas = SVGCanvas(width, height)
|
|
201
|
+
screen = SVGScreen(canvas)
|
|
202
|
+
super().__init__(screen)
|
|
203
|
+
self.speed(0)
|
|
204
|
+
|
|
205
|
+
def _drawturtle(self):
|
|
206
|
+
pass
|
|
207
|
+
|
|
208
|
+
def pen(self, pen=None, **pendict):
|
|
209
|
+
if not (pen or pendict):
|
|
210
|
+
return super().pen()
|
|
211
|
+
p = dict(pen) if isinstance(pen, dict) else {}
|
|
212
|
+
p.update(pendict)
|
|
213
|
+
p['speed'] = 0
|
|
214
|
+
return super().pen(p)
|
|
215
|
+
|
|
216
|
+
def save_as(self, filename: str, group_colors: bool = True):
|
|
217
|
+
canvas = self.getscreen().cv
|
|
218
|
+
_write_svg(canvas, canvas.winfo_width(), canvas.winfo_height(),
|
|
219
|
+
filename, group_colors=group_colors)
|
|
220
|
+
|
|
221
|
+
|
|
222
|
+
def _write_svg(canvas: SVGCanvas, width: int, height: int, filename: str,
|
|
223
|
+
group_colors: bool = True):
|
|
224
|
+
"""Write canvas contents to an SVG file.
|
|
225
|
+
|
|
226
|
+
TurtleScreenBase sets scrollregion to (-w//2, -h//2, w//2, h//2), so
|
|
227
|
+
canvas coordinates are (turtle_x, -turtle_y). The SVG offset is therefore
|
|
228
|
+
simply (width/2, height/2).
|
|
229
|
+
"""
|
|
230
|
+
xoff = width / 2
|
|
231
|
+
yoff = height / 2
|
|
232
|
+
|
|
233
|
+
def point_str(flat_coords):
|
|
234
|
+
pairs = []
|
|
235
|
+
it = iter(flat_coords)
|
|
236
|
+
for x in it:
|
|
237
|
+
y = next(it)
|
|
238
|
+
pairs.append(f'{x + xoff:.3f},{y + yoff:.3f}')
|
|
239
|
+
return ' '.join(pairs)
|
|
240
|
+
|
|
241
|
+
# Only emit visible, non-deleted line/polygon items.
|
|
242
|
+
# Items with fill='' are invisible placeholders (turtle cursor, undrawn lines).
|
|
243
|
+
drawable = [
|
|
244
|
+
item for item in sorted(canvas._items, key=lambda i: i.z_order)
|
|
245
|
+
if not item.deleted
|
|
246
|
+
and item.method in ('line', 'polygon')
|
|
247
|
+
and item.attribs.get('fill', '') != ''
|
|
248
|
+
]
|
|
249
|
+
|
|
250
|
+
clip = 'clip-path="url(#border)"'
|
|
251
|
+
out = [
|
|
252
|
+
f'<svg xmlns="http://www.w3.org/2000/svg"'
|
|
253
|
+
f' viewBox="0 0 {width} {height}"'
|
|
254
|
+
f' width="{width}" height="{height}">',
|
|
255
|
+
' <defs>',
|
|
256
|
+
' <clipPath id="border">',
|
|
257
|
+
f' <rect width="{width}" height="{height}"/>',
|
|
258
|
+
' </clipPath>',
|
|
259
|
+
' </defs>',
|
|
260
|
+
]
|
|
261
|
+
|
|
262
|
+
if group_colors:
|
|
263
|
+
lines_by_color: dict[str, list[_CanvasItem]] = defaultdict(list)
|
|
264
|
+
fill_items: list[_CanvasItem] = []
|
|
265
|
+
|
|
266
|
+
for item in drawable:
|
|
267
|
+
if item.method == 'line':
|
|
268
|
+
lines_by_color[item.attribs.get('fill', 'black')].append(item)
|
|
269
|
+
else:
|
|
270
|
+
fill_items.append(item)
|
|
271
|
+
|
|
272
|
+
for color, group in lines_by_color.items():
|
|
273
|
+
out.append(
|
|
274
|
+
f' <g stroke="{color}" fill="none"'
|
|
275
|
+
f' stroke-linecap="round" {clip}>'
|
|
276
|
+
)
|
|
277
|
+
for item in group:
|
|
278
|
+
sw = item.attribs.get('width', 1)
|
|
279
|
+
out.append(
|
|
280
|
+
f' <polyline points="{point_str(item.coords)}"'
|
|
281
|
+
f' stroke-width="{sw}"/>'
|
|
282
|
+
)
|
|
283
|
+
out.append(' </g>')
|
|
284
|
+
|
|
285
|
+
for item in fill_items:
|
|
286
|
+
fill = item.attribs.get('fill', 'none')
|
|
287
|
+
stroke = item.attribs.get('outline', '') or 'none'
|
|
288
|
+
sw = item.attribs.get('width', 0)
|
|
289
|
+
out.append(
|
|
290
|
+
f' <polygon points="{point_str(item.coords)}"'
|
|
291
|
+
f' fill="{fill}" stroke="{stroke}" stroke-width="{sw}"'
|
|
292
|
+
f' fill-rule="evenodd" {clip}/>'
|
|
293
|
+
)
|
|
294
|
+
else:
|
|
295
|
+
for item in drawable:
|
|
296
|
+
pts = point_str(item.coords)
|
|
297
|
+
if item.method == 'line':
|
|
298
|
+
color = item.attribs.get('fill', 'black')
|
|
299
|
+
sw = item.attribs.get('width', 1)
|
|
300
|
+
out.append(
|
|
301
|
+
f' <polyline points="{pts}"'
|
|
302
|
+
f' stroke="{color}" stroke-width="{sw}"'
|
|
303
|
+
f' fill="none" stroke-linecap="round" {clip}/>'
|
|
304
|
+
)
|
|
305
|
+
else:
|
|
306
|
+
fill = item.attribs.get('fill', 'none')
|
|
307
|
+
stroke = item.attribs.get('outline', '') or 'none'
|
|
308
|
+
sw = item.attribs.get('width', 0)
|
|
309
|
+
out.append(
|
|
310
|
+
f' <polygon points="{pts}"'
|
|
311
|
+
f' fill="{fill}" stroke="{stroke}" stroke-width="{sw}"'
|
|
312
|
+
f' fill-rule="evenodd" {clip}/>'
|
|
313
|
+
)
|
|
314
|
+
|
|
315
|
+
out.append('</svg>')
|
|
316
|
+
with open(filename, 'w') as f:
|
|
317
|
+
f.write('\n'.join(out) + '\n')
|
superturtle-1.2.1/pyproject.toml
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
[project]
|
|
2
|
-
name = "superturtle"
|
|
3
|
-
version = "1.2.1"
|
|
4
|
-
description = "Extensions to Python's turtle"
|
|
5
|
-
authors = [
|
|
6
|
-
{name="Chris Proctor", email="chris@chrisproctor.net"}
|
|
7
|
-
]
|
|
8
|
-
license = {text = "MIT"}
|
|
9
|
-
readme = "README.md"
|
|
10
|
-
documentation = "https://docs.makingwithcode.org/superturtle"
|
|
11
|
-
requires-python = ">=3.10,<4.0"
|
|
12
|
-
|
|
13
|
-
[tool.poetry.group.docs]
|
|
14
|
-
optional = true
|
|
15
|
-
|
|
16
|
-
[tool.poetry.group.docs.dependencies]
|
|
17
|
-
sphinx = "^7.0.1"
|
|
18
|
-
furo = "^2023.5.20"
|
|
19
|
-
|
|
20
|
-
[tool.poetry.group.dev]
|
|
21
|
-
optional = true
|
|
22
|
-
|
|
23
|
-
[tool.poetry.group.dev.dependencies]
|
|
24
|
-
pytest = "^5.2"
|
|
25
|
-
|
|
26
|
-
[tool.poetry.dependencies]
|
|
27
|
-
svg-turtle = "^1.0.0"
|
|
28
|
-
|
|
29
|
-
[build-system]
|
|
30
|
-
requires = ["poetry-core>=2.0.0,<3.0.0"]
|
|
31
|
-
build-backend = "poetry.core.masonry.api"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = '1.1.0'
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|