If I move a turtle to a position using turtle.teleport(…) I get a complicated error message which finishes “‘float’ object is not subscriptable”. If, instead, I move the turtle to the same position using turtle.setposition(…) with the pen up there is no error. Both strategies should do the same thing, IWHT. What is the difference? The type of the position is “class ‘turtle.Vec2D’” which is said to be derived from the tuple type. It doesn’t seem to behave as a tuple.
turtle.setposition supports taking a 2-tuple of numbers as its first arg. turtle.teleport does not. Try unpacking the tuple with a * if using the latter, e.g. turtle.teleport(*xy_pos)
turtle.teleport(x, y=None, ***, fill_gap=False )
Parameters:
- x – a number or
None- y – a number or
None- fill_gap – a boolean
turtle.setposition(x, y=None )
Parameters:
- x – a number or a pair/vector of numbers
- y – a number or
None
I don’t use or work on the library, but I would’ve thought this is a simple feature request to implement.