Turtle - rotate head when shape is set to image
Nadie ha tomado este issue todavía.
- Lenguaje dominante
- Python
- Estrellas
- 77.2k
- Forks
- 35.9k
- Métricas de merge de PR
- Métricas de PR pendientes
Descripción
Feature or enhancement
Proposal:
I found turtle module to be a great way to introduce my kid to programming. I spotted that he is especially enjoying some interactive scripts, that react to keys or clicking. My problem is that currently when head shape is set to an image, it's not getting rotated which is quite a limitation when it comes to achieving some interesting effects while keeping the code simple.
Would you consider adding an option to rotate turtle head shape when it's set to an image to the library?
Sample code could work like this:
import turtle
sc = turtle.Screen()
sc.addshape("./car.png", rotate_image_shape=True)
t = turtle.Turtle()
t.shape("./car.png")
def handle_click(x,y):
t.setheading(t.towards(x,y))
t.goto(x,y)
sc.onclick(handle_click)
turtle.mainloop()
so unless you explicitly say that you want to rotate image shape, it would work as it used to.
I did some research and implemented sample solution here:
https://github.com/python/cpython/compare/main...kbialowas:cpython:tilt-turtle-transformation
Has this already been discussed elsewhere?
This is a minor feature, which does not need previous discussion elsewhere
Links to previous discussion of this feature:
https://discuss.python.org/t/turtle-make-it-possible-to-tilt-image-shape/81890/2
Linked PRs
- gh-130855
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Línea de trabajo
Comienza con los puntos de entrada del módulo turtle mostrados en la propuesta, especialmente Screen.addshape(), Turtle.shape() y los cambios de orientación; después, revisa la solución de ejemplo enlazada y el PR gh-130855. Se considera terminado cuando las formas de imagen pueden optar por rotar, manteniendo el comportamiento existente cuando se omite la opción.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- python
- Área
- desktop
- Tipo de issue
- Nueva funcionalidad
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Estado de actividad
- Estancado
- Claridad
- Bastante claro
- Aptitud para principiantes
- 25/100