ColabTurtlePlus 2.1.1__tar.gz → 2.1.2__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.
@@ -39,6 +39,9 @@ Added addcomponent() to create new polygonal turtles. Because turtles are define
39
39
  new functions, addellipsecomponent() and addpathcomponent, to create turtles bassed on ellipical shapes and svg
40
40
  paths. To be consistent with Python's turtle, these are first invoked using a call to Shape("compound") and then
41
41
  combined using register_shape().
42
+
43
+ v2.1.2 September 2026
44
+ Fixed an issue introduced with register_shape when two or more turtles had the same shape.
42
45
  """
43
46
 
44
47
  DEFAULT_WINDOW_SIZE = (800, 600)
@@ -218,7 +221,7 @@ class _Screen:
218
221
  degrees -= 90
219
222
 
220
223
 
221
- svg = shapeDict[turtle.turtle_shape].format(
224
+ svg = turtle.shapeDict[turtle.turtle_shape].format(
222
225
  turtle_color=turtle.fill_color,
223
226
  pcolor=turtle.pen_color,
224
227
  turtle_x=turtle_x,
@@ -401,10 +404,11 @@ class _Screen:
401
404
  turtle_x="{turtle_x}",
402
405
  turtle_y="{turtle_y}",
403
406
  )
404
- # componentDict[shape] = tm
405
407
  name = name.lower()
406
408
  VALID_TURTLE_SHAPES.add(name)
407
409
  shapeDict[name] = tmp
410
+ for turtle in self._turtles:
411
+ turtle.shapeDict = shapeDict.copy()
408
412
  addshape=register_shape
409
413
 
410
414
  #=========================
@@ -1019,8 +1023,8 @@ class RawTurtle:
1019
1023
  self.stampnum = 0
1020
1024
  self.stamplist=[]
1021
1025
  self.points = DEFAULT_POINTS
1022
-
1023
- if screen._mode == "svg": shapeDict.update({"circle":TURTLE_RING_SVG_TEMPLATE})
1026
+ self.shapeDict = shapeDict.copy()
1027
+ if screen._mode == "svg": self.shapeDict.update({"circle":TURTLE_RING_SVG_TEMPLATE})
1024
1028
  screen._add(self)
1025
1029
 
1026
1030
 
@@ -1096,7 +1100,7 @@ class RawTurtle:
1096
1100
  self.screen._updateDrawing(turtle=self)
1097
1101
  elif self.turtle_shape != 'ring' and self.stretchfactor[0]==self.stretchfactor[1]:
1098
1102
  stretchfactor_orig = self.stretchfactor
1099
- template = shapeDict[self.turtle_shape]
1103
+ template = self.shapeDict[self.turtle_shape]
1100
1104
  tmp = """<animateTransform id = "one" attributeName="transform"
1101
1105
  type="scale"
1102
1106
  from="{sx} {sy}" to="{sx} {sy}"
@@ -1113,13 +1117,13 @@ class RawTurtle:
1113
1117
  fill="freeze"
1114
1118
  /></g>""".format(extent=deg, t=self.timeout*abs(deg)/90, sx=self.stretchfactor[0], sy=self.stretchfactor[1])
1115
1119
  newtemplate = template.replace("</g>",tmp)
1116
- shapeDict.update({self.turtle_shape:newtemplate})
1120
+ self.shapeDict.update({self.turtle_shape:newtemplate})
1117
1121
  self.stretchfactor = 1,1
1118
1122
  self.timeout = self.timeout*abs(deg)/90+0.001
1119
1123
  self.screen._updateDrawing(self)
1120
1124
  self.turtle_degree = (self.turtle_degree + deg) % 360
1121
1125
  self.turtle_orient = self._turtleOrientation()
1122
- shapeDict.update({self.turtle_shape:template})
1126
+ self.shapeDict.update({self.turtle_shape:template})
1123
1127
  self.stretchfactor = stretchfactor_orig
1124
1128
  self.timeout = timeout_orig
1125
1129
  else: #_turtle_shape == 'ring' or _stretchfactor[0] != _stretchfactor[1]
@@ -1772,7 +1776,7 @@ class RawTurtle:
1772
1776
  return 360-deg
1773
1777
 
1774
1778
  def extract_points(self):
1775
- svg_string = shapeDict[self.turtle_shape]
1779
+ svg_string = self.shapeDict[self.turtle_shape]
1776
1780
  match = re.search(r'points="([^"]*)"', svg_string)
1777
1781
  if not match:
1778
1782
  raise ValueError("No points attribute found")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ColabTurtlePlus
3
- Version: 2.1.1
3
+ Version: 2.1.2
4
4
  Summary: An HTML based Turtle implementation with classes for Google Colab and Jupyter Labs
5
5
  Home-page: https://github.com/mathriddle/ColabTurtlePlus
6
6
  Author: Larry Riddle
@@ -39,6 +39,8 @@ Sept. 2026: Version 2.1.0 adds a register_shape (alias addshape) function to cre
39
39
 
40
40
  Sept. 2026: Version 2.1.1 allows use of addcomponent() to add a polygon to a component turtle shape. There are two new ways to build additional components: addellipsecomponent() adds an elliptical shape, and addpathcompenent adds a path defined using svg path commands.
41
41
 
42
+ Sept. 2026: Version 2.1.2. Bug fix when multiple turtles have the same shape.
43
+
42
44
  Installation
43
45
  ----
44
46
  Create an empty code cell and type:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ColabTurtlePlus
3
- Version: 2.1.1
3
+ Version: 2.1.2
4
4
  Summary: An HTML based Turtle implementation with classes for Google Colab and Jupyter Labs
5
5
  Home-page: https://github.com/mathriddle/ColabTurtlePlus
6
6
  Author: Larry Riddle
@@ -39,6 +39,8 @@ Sept. 2026: Version 2.1.0 adds a register_shape (alias addshape) function to cre
39
39
 
40
40
  Sept. 2026: Version 2.1.1 allows use of addcomponent() to add a polygon to a component turtle shape. There are two new ways to build additional components: addellipsecomponent() adds an elliptical shape, and addpathcompenent adds a path defined using svg path commands.
41
41
 
42
+ Sept. 2026: Version 2.1.2. Bug fix when multiple turtles have the same shape.
43
+
42
44
  Installation
43
45
  ----
44
46
  Create an empty code cell and type:
@@ -14,6 +14,8 @@ Sept. 2026: Version 2.1.0 adds a register_shape (alias addshape) function to cre
14
14
 
15
15
  Sept. 2026: Version 2.1.1 allows use of addcomponent() to add a polygon to a component turtle shape. There are two new ways to build additional components: addellipsecomponent() adds an elliptical shape, and addpathcompenent adds a path defined using svg path commands.
16
16
 
17
+ Sept. 2026: Version 2.1.2. Bug fix when multiple turtles have the same shape.
18
+
17
19
  Installation
18
20
  ----
19
21
  Create an empty code cell and type:
@@ -1,6 +1,6 @@
1
1
  [metadata]
2
2
  name = ColabTurtlePlus
3
- version = 2.1.1
3
+ version = 2.1.2
4
4
  author = Larry Riddle
5
5
  author_email = lriddle@agnesscott.edu
6
6
  description = 'An HTML based Turtle implementation with classes for Google Colab and Jupyter Labs'
@@ -9,7 +9,7 @@ README = (HERE / "README.md").read_text()
9
9
 
10
10
  setup(
11
11
  name='ColabTurtlePlus',
12
- version='2.1.1',
12
+ version='2.1.2',
13
13
  packages=['ColabTurtlePlus'],
14
14
  url='https://github.com/mathriddle/ColabTurtlePlus',
15
15
  license='MIT',
File without changes