turtleshell 1.1.0__tar.gz → 1.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.
- {turtleshell-1.1.0 → turtleshell-1.2.0}/PKG-INFO +1 -1
- {turtleshell-1.1.0 → turtleshell-1.2.0}/README.md +0 -0
- {turtleshell-1.1.0 → turtleshell-1.2.0}/pyproject.toml +2 -2
- {turtleshell-1.1.0 → turtleshell-1.2.0}/setup.cfg +0 -0
- {turtleshell-1.1.0 → turtleshell-1.2.0}/src/turtleshell/__init__.py +1 -1
- {turtleshell-1.1.0 → turtleshell-1.2.0}/src/turtleshell/core.py +25 -31
- {turtleshell-1.1.0 → turtleshell-1.2.0}/src/turtleshell.egg-info/PKG-INFO +1 -1
- {turtleshell-1.1.0 → turtleshell-1.2.0}/src/turtleshell.egg-info/SOURCES.txt +0 -0
- {turtleshell-1.1.0 → turtleshell-1.2.0}/src/turtleshell.egg-info/dependency_links.txt +0 -0
- {turtleshell-1.1.0 → turtleshell-1.2.0}/src/turtleshell.egg-info/requires.txt +0 -0
- {turtleshell-1.1.0 → turtleshell-1.2.0}/src/turtleshell.egg-info/top_level.txt +0 -0
- {turtleshell-1.1.0 → turtleshell-1.2.0}/tests/test_turtle.py +4 -2
File without changes
|
@@ -1,6 +1,6 @@
|
|
1
1
|
[project]
|
2
2
|
name = "turtleshell"
|
3
|
-
version = "1.
|
3
|
+
version = "1.2.0"
|
4
4
|
authors = [
|
5
5
|
{ name="Sam Mangan", email="sam.mangan2@gmail.com" },
|
6
6
|
]
|
@@ -27,7 +27,7 @@ addopts = [
|
|
27
27
|
]
|
28
28
|
|
29
29
|
[tool.bumpver]
|
30
|
-
current_version = "1.
|
30
|
+
current_version = "1.2.0"
|
31
31
|
version_pattern = "MAJOR.MINOR.PATCH"
|
32
32
|
commit_message = "Bump version {old_version} -> {new_version}"
|
33
33
|
commit = true
|
File without changes
|
@@ -76,16 +76,32 @@ class Turtle(turtle.RawTurtle):
|
|
76
76
|
def y(self, value):
|
77
77
|
self.sety(value)
|
78
78
|
|
79
|
-
|
80
|
-
def shapewidth(self):
|
81
|
-
xcoords = [vertex[0] for vertex in self.get_shapepoly()]
|
82
|
-
return max(xcoords) - min(xcoords)
|
79
|
+
def shapesize(self, stretch_wid=None, stretch_len=None, outline=None):
|
83
80
|
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
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)
|
88
100
|
|
101
|
+
def to_front(self):
|
102
|
+
self.goto(self.position())
|
103
|
+
|
104
|
+
## HSV colour methods
|
89
105
|
def hue(self, degrees):
|
90
106
|
self.penhue(degrees)
|
91
107
|
self.fillhue(degrees)
|
@@ -122,26 +138,6 @@ class Turtle(turtle.RawTurtle):
|
|
122
138
|
self._fill_hsv.val = value/100
|
123
139
|
self.fillcolor(_hsv_to_rgb(self._fill_hsv))
|
124
140
|
|
125
|
-
def shapesize(self, stretch_wid=None, stretch_len=None, outline=None):
|
126
|
-
if stretch_wid is None and stretch_len is None and outline is None:
|
127
|
-
stretch_wid, stretch_len, outline = super().shapesize()
|
128
|
-
return stretch_wid*Turtle.MULT, stretch_len*Turtle.MULT, outline
|
129
|
-
|
130
|
-
stretch_wid = stretch_wid/Turtle.MULT if stretch_wid else None
|
131
|
-
stretch_len = stretch_len/Turtle.MULT if stretch_len else None
|
132
|
-
ret = super().shapesize(stretch_wid, stretch_len, outline)
|
133
|
-
return ret
|
134
|
-
|
135
|
-
def teleport(self, x, y):
|
136
|
-
pendown = self.isdown()
|
137
|
-
if pendown:
|
138
|
-
self.pen(pendown=False)
|
139
|
-
self.penup()
|
140
|
-
self._position = turtle.Vec2D(x, y)
|
141
|
-
self.pen(pendown=pendown)
|
142
|
-
|
143
|
-
def write(self, arg, move=False, align="center", font=("Arial", 18, "bold")):
|
144
|
-
super().write(arg, move, align, font)
|
145
141
|
|
146
142
|
Pen = Turtle
|
147
143
|
|
@@ -152,9 +148,7 @@ if __name__ == "__main__":
|
|
152
148
|
print(f"\n\n***\nTURTLE TYPE: {type(pen)}\nSCREEN TYPE: {type(canvas)}\n***\n")
|
153
149
|
|
154
150
|
pen.shape("square")
|
155
|
-
print(f"{pen.shapewidth}, {pen.shapeheight}")
|
156
151
|
pen.shapesize(30, 25)
|
157
|
-
print(f"{pen.shapewidth}, {pen.shapeheight}")
|
158
152
|
|
159
153
|
pen.hue(0)
|
160
154
|
pen.stamp()
|
@@ -171,4 +165,4 @@ if __name__ == "__main__":
|
|
171
165
|
pen.hue(240)
|
172
166
|
pen.stamp()
|
173
167
|
|
174
|
-
canvas.exitonclick()
|
168
|
+
canvas.exitonclick()
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -28,8 +28,10 @@ def test_y(pen):
|
|
28
28
|
def test_shapesize_set(pen):
|
29
29
|
pen.shape("square")
|
30
30
|
pen.shapesize(30,40)
|
31
|
-
|
32
|
-
assert
|
31
|
+
width, height, outline = pen.shapesize()
|
32
|
+
assert width == 30
|
33
|
+
assert height == 40
|
34
|
+
assert outline == 1
|
33
35
|
|
34
36
|
def test_shapesize_get(pen):
|
35
37
|
pen.shape("square")
|