如何在Python的Turtle图形中创建旋转的文本?
我正在使用TKINTER和TCL版本8.6使用Python 3.9,因此根据答案应该能够绘制旋转的文本。实际上,我能够在tkinter中绘制旋转的文本,因此我也尝试使用Turtle模块写作旋转的文本:
import turtle
txt = '
I am using Python 3.9 with tkinter and tcl version 8.6, so according to an answer here on stackoverflow from the year 2010, I should be able to draw rotated texts. And actually I am able to draw rotated texts in tkinter so I tried to create a rotated text with the turtle module too writing:
import turtle
txt = '???? ???? ???? ???? ???? ????'
tt = turtle.Turtle()
tt.write(txt, angle=-45)
but got an error message: TypeError: write() got an unexpected keyword argument 'angle'
which means that the turtle module does not yet support the text rotating feature.
This rises the question: Do someone know about a patch/fix which enables the turtle module to make use of the text rotation feature available in Python 3 since version 3.7.2 ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我已经编写了一个补丁的代码,如果添加为乌龟python脚本的标题,则允许使用关键字参数
txt_angle
用于创建旋转的文本,以便代码:I have written code of a patch which if added as a header to the turtle Python script allows to use the keyword argument
txt_angle
for creating rotated texts, so that the code:doesn't raise a TypeError and draws a 45 degree rotated text.
Below the code of the patch followed by a short turtle script code creating attached image out of the rotated text: