Working with Turtle in Pythonista
I have recently been messing around with the
turtlemodule on PC and have come up with a few handy programs. I then became curious about the possibilities on Pythonista. I am attempting to make a simple program where the title will move to where the user taps. The
onclick()does not seem to work. I will include the code I was trying to use below. How would I make a program like this and is there any documentation on turtle in Pythonista (I couldn’t find any)?
from turtle import * speed(0) screen = Screen() def moveTo(x, y): setpos(x, y) screen.onclick(moveTo) screen.listen()
@rex_noctis, documentation: write 'turtle' in the editor, select the word, from the context menu arrow right and 'help'.
I do not see 'onclick' in the help. Probably Pythonista has a different (older?) version of the module.
You can override the screens tap
S = getscreen() S.touch_enabled = True S.touch_began = myfunktionname
In the console
import turtle, editor editor.open_file(turtle.__file__)
This will let you see exactly how turtle was implemented in pythonista.
Alternatively, here is a modified version that includes pen shapes.