Script does not run like it should on pythonista
trezor last edited by
# SpiralMyName.py - prints a colorful spiral of the user's name import turtle t = turtle.Pen() turtle.bgcolor('white') colors = ['red', 'yellow', 'blue', 'green'] # Ask the user's name using turtle's textinput pop-up window your_name = turtle.textinput('Enter your name', 'What is your name?') # Draw a spiral of the name on the screen, written 100 times for x in range(100): t.pencolor(colors[x%4]) # Rotate through the four colors. t.penup() # Don't draw the regular spiral lines t.forward(x*4) # Just move the turtle on the screen t.pendown() # Write the user's name, bigger each time t.write(your_name, font=('Arial', int((x+4)/4), 'bold')) t.left(92) # Turn left, just as in our other spirals ``` When I run this script in pythonista, the output is different to what I expected in two ways: - For some reason, the text is not written in different colors like it should. I cannot find an error in the for loop I have written. - The text should increase in size with every new loop and should be in bold. Both does not happen. The text stays in black and is all the same size. Apart from that, the program runs normally. When I run this code on my MacBook Pro the output appears like it should. I have checked my code for syntax errors with the keyword argument font, but I cannot see what I have done wrong.
ccc last edited by
https://forum.omz-software.com/search/Turtle has always been a bit incomplete in Pythonista.