6

I want to make diagrams with python's turtle (teaching purposes). The label "values" for the y-axis should be rotated.
Python's turtle has a method to write a string at current position:

from turtle import *
left(90) # does not help
write("values", font=('Arial', 12, 'normal'))
hideturtle()
mainloop()

"values" is still horizontal.

How can I rotate text with python's turtle?

ggorlen
  • 44,755
  • 7
  • 76
  • 106
drumherum
  • 153
  • 3
  • 6
  • Related: [how to upside down a text in python turtle.write() method?](https://stackoverflow.com/questions/47729657/how-to-upside-down-a-text-in-python-turtle-write-method) and [How to create rotated text in Python's turtle graphics?](https://stackoverflow.com/questions/72749874/how-to-create-rotated-text-in-pythons-turtle-graphics) – ggorlen Dec 06 '22 at 00:46

2 Answers2

5

It's not possible to write rotated text with turtle. See http://www.gossamer-threads.com/lists/python/bugs/879806:

Turtle is built on top of Tk, which is currently at version 8.5 - this has no ability to rotate text. When Tk version 8.6 arrives it should be able to write rotated text (see http://mail.python.org/pipermail/tkinter-discuss/2010-November/002490.html) and turtle.py could be updated to take advantage of it.

Pär Wieslander
  • 28,374
  • 7
  • 55
  • 54
0

You CAN rotate text, but only in Tkinter 8.6. Type:

pyturtle.rotate([Degrees of rotation])

Then you can do your text command. Hope this helped!

ggorlen
  • 44,755
  • 7
  • 76
  • 106
xezno
  • 79
  • 1
  • 10