turtleshell 1.0.0__py3-none-any.whl → 1.2.0__py3-none-any.whl
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.
- turtleshell/__init__.py +1 -1
- turtleshell/core.py +27 -27
- {turtleshell-1.0.0.dist-info → turtleshell-1.2.0.dist-info}/METADATA +40 -1
- turtleshell-1.2.0.dist-info/RECORD +6 -0
- {turtleshell-1.0.0.dist-info → turtleshell-1.2.0.dist-info}/WHEEL +1 -1
- turtleshell-1.0.0.dist-info/RECORD +0 -6
- {turtleshell-1.0.0.dist-info → turtleshell-1.2.0.dist-info}/top_level.txt +0 -0
turtleshell/__init__.py
CHANGED
turtleshell/core.py
CHANGED
@@ -44,6 +44,7 @@ class Turtle(turtle.RawTurtle):
|
|
44
44
|
|
45
45
|
_pen = None
|
46
46
|
_screen = None
|
47
|
+
MULT = 20
|
47
48
|
|
48
49
|
def __init__(self,
|
49
50
|
shape=turtle._CFG["shape"],
|
@@ -55,7 +56,7 @@ class Turtle(turtle.RawTurtle):
|
|
55
56
|
shape=shape,
|
56
57
|
undobuffersize=undobuffersize,
|
57
58
|
visible=visible)
|
58
|
-
self.shapesize(
|
59
|
+
self.shapesize(Turtle.MULT)
|
59
60
|
self._pen_hsv = HSV(0, 1, 1)
|
60
61
|
self._fill_hsv = HSV(0, 1, 1)
|
61
62
|
|
@@ -75,16 +76,32 @@ class Turtle(turtle.RawTurtle):
|
|
75
76
|
def y(self, value):
|
76
77
|
self.sety(value)
|
77
78
|
|
78
|
-
|
79
|
-
def shapewidth(self):
|
80
|
-
xcoords = [vertex[0] for vertex in self.get_shapepoly()]
|
81
|
-
return max(xcoords) - min(xcoords)
|
79
|
+
def shapesize(self, stretch_wid=None, stretch_len=None, outline=None):
|
82
80
|
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
81
|
+
if stretch_wid is None and stretch_len is None and outline is None:
|
82
|
+
stretch_wid, stretch_len, outline = super().shapesize()
|
83
|
+
return stretch_wid*Turtle.MULT, stretch_len*Turtle.MULT, outline
|
84
|
+
|
85
|
+
stretch_wid = stretch_wid/Turtle.MULT if stretch_wid else None
|
86
|
+
stretch_len = stretch_len/Turtle.MULT if stretch_len else None
|
87
|
+
ret = super().shapesize(stretch_wid, stretch_len, outline)
|
88
|
+
return ret
|
89
|
+
|
90
|
+
def teleport(self, x, y):
|
91
|
+
pendown = self.isdown()
|
92
|
+
if pendown:
|
93
|
+
self.pen(pendown=False)
|
94
|
+
self.penup()
|
95
|
+
self._position = turtle.Vec2D(x, y)
|
96
|
+
self.pen(pendown=pendown)
|
97
|
+
|
98
|
+
def write(self, arg, move=False, align="center", font=("Arial", 18, "bold")):
|
99
|
+
super().write(arg, move, align, font)
|
100
|
+
|
101
|
+
def to_front(self):
|
102
|
+
self.goto(self.position())
|
87
103
|
|
104
|
+
## HSV colour methods
|
88
105
|
def hue(self, degrees):
|
89
106
|
self.penhue(degrees)
|
90
107
|
self.fillhue(degrees)
|
@@ -121,21 +138,6 @@ class Turtle(turtle.RawTurtle):
|
|
121
138
|
self._fill_hsv.val = value/100
|
122
139
|
self.fillcolor(_hsv_to_rgb(self._fill_hsv))
|
123
140
|
|
124
|
-
def shapesize(self, stretch_wid=None, stretch_len=None, outline=None):
|
125
|
-
stretch_wid = stretch_wid/20 if stretch_wid else None
|
126
|
-
stretch_len = stretch_len/20 if stretch_len else None
|
127
|
-
super().shapesize(stretch_wid, stretch_len, outline)
|
128
|
-
|
129
|
-
def teleport(self, x, y):
|
130
|
-
pendown = self.isdown()
|
131
|
-
if pendown:
|
132
|
-
self.pen(pendown=False)
|
133
|
-
self.penup()
|
134
|
-
self._position = turtle.Vec2D(x, y)
|
135
|
-
self.pen(pendown=pendown)
|
136
|
-
|
137
|
-
def write(self, arg, move=False, align="center", font=("Arial", 18, "bold")):
|
138
|
-
super().write(arg, move, align, font)
|
139
141
|
|
140
142
|
Pen = Turtle
|
141
143
|
|
@@ -146,9 +148,7 @@ if __name__ == "__main__":
|
|
146
148
|
print(f"\n\n***\nTURTLE TYPE: {type(pen)}\nSCREEN TYPE: {type(canvas)}\n***\n")
|
147
149
|
|
148
150
|
pen.shape("square")
|
149
|
-
print(f"{pen.shapewidth}, {pen.shapeheight}")
|
150
151
|
pen.shapesize(30, 25)
|
151
|
-
print(f"{pen.shapewidth}, {pen.shapeheight}")
|
152
152
|
|
153
153
|
pen.hue(0)
|
154
154
|
pen.stamp()
|
@@ -165,4 +165,4 @@ if __name__ == "__main__":
|
|
165
165
|
pen.hue(240)
|
166
166
|
pen.stamp()
|
167
167
|
|
168
|
-
canvas.exitonclick()
|
168
|
+
canvas.exitonclick()
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: turtleshell
|
3
|
-
Version: 1.
|
3
|
+
Version: 1.2.0
|
4
4
|
Summary: Convenience wrapper around turtle.Turtle and turtle.Screen
|
5
5
|
Author-email: Sam Mangan <sam.mangan2@gmail.com>
|
6
6
|
License-Expression: MIT
|
@@ -16,3 +16,42 @@ Requires-Dist: pytest; extra == "dev"
|
|
16
16
|
# TurtleShell
|
17
17
|
|
18
18
|
Convenience wrapper around Python turtle standard library.
|
19
|
+
|
20
|
+
## Development
|
21
|
+
Do all this in a virtual environment, e.g.
|
22
|
+
```
|
23
|
+
python3 -m venv venv
|
24
|
+
./venv/bin/activate
|
25
|
+
```
|
26
|
+
|
27
|
+
Test changes:
|
28
|
+
```
|
29
|
+
pip install pytest
|
30
|
+
pytest
|
31
|
+
```
|
32
|
+
|
33
|
+
Push changes.
|
34
|
+
|
35
|
+
Update package version:
|
36
|
+
```
|
37
|
+
pip install bumpver
|
38
|
+
bumpver update --minor
|
39
|
+
```
|
40
|
+
|
41
|
+
Build and check package with twine:
|
42
|
+
```
|
43
|
+
pip install build twine
|
44
|
+
python -m build
|
45
|
+
twine check dist/*
|
46
|
+
```
|
47
|
+
|
48
|
+
Upload to Test PyPI, install, and test:
|
49
|
+
```
|
50
|
+
twine upload -r testpypi dist/*
|
51
|
+
pip install -i https://test.pypi.org/simple turtleshell
|
52
|
+
```
|
53
|
+
|
54
|
+
Upload to PyPI:
|
55
|
+
```
|
56
|
+
twine upload dist/*
|
57
|
+
```
|
@@ -0,0 +1,6 @@
|
|
1
|
+
turtleshell/__init__.py,sha256=85lJZi_-C3nKgx2AqgwkiuvLjk3pBtACIQynLTj7nSc,55
|
2
|
+
turtleshell/core.py,sha256=WYMtNv225fTi55bfxDqJhem25E18TNqJl116j77Rl5A,4410
|
3
|
+
turtleshell-1.2.0.dist-info/METADATA,sha256=C6XQ5TfWKndLSBhkKHOqyVUc44zH8nKi3wuaaXUaSl0,1124
|
4
|
+
turtleshell-1.2.0.dist-info/WHEEL,sha256=Nw36Djuh_5VDukK0H78QzOX-_FQEo6V37m3nkm96gtU,91
|
5
|
+
turtleshell-1.2.0.dist-info/top_level.txt,sha256=nIp6ZtgikYbeYxpXq6zs04zeIaXIMs3ZzAx5QREfkYM,12
|
6
|
+
turtleshell-1.2.0.dist-info/RECORD,,
|
@@ -1,6 +0,0 @@
|
|
1
|
-
turtleshell/__init__.py,sha256=h6t_4SE0atKJUhhgKKa_b-sPBTxZss4hnR-EnqRIixU,55
|
2
|
-
turtleshell/core.py,sha256=6MXthwzvQmFWqnGJKijjn1olIzG_jS8WyGcMoXH1i1A,4437
|
3
|
-
turtleshell-1.0.0.dist-info/METADATA,sha256=OOy35r3xo3pqEC-JNtB1z_wEmKaePxOf4fHjWxABPBA,590
|
4
|
-
turtleshell-1.0.0.dist-info/WHEEL,sha256=0CuiUZ_p9E4cD6NyLD6UG80LBXYyiSYZOKDm5lp32xk,91
|
5
|
-
turtleshell-1.0.0.dist-info/top_level.txt,sha256=nIp6ZtgikYbeYxpXq6zs04zeIaXIMs3ZzAx5QREfkYM,12
|
6
|
-
turtleshell-1.0.0.dist-info/RECORD,,
|
File without changes
|