Turtle - rotate head when shape is set to image
まだ誰も着手していません。
- 主要言語
- Python
- スター
- 77.2k
- フォーク
- 35.9k
- PR マージ指標
- PR 指標を取得中
説明
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
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
提案に示されている turtle モジュールのエントリポイント、特に Screen.addshape()、Turtle.shape()、heading の変更から始め、リンク先のサンプルソリューションと PR gh-130855 を確認してください。オプションを省略した場合は既存の動作を維持しつつ、画像形状で回転を選択できるようになれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- python
- 領域
- desktop
- issue の種類
- 機能追加
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 25/100