Welcome!
This is the community forum for my apps Pythonista and Editorial.
For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.
Working with Turtle in Pythonista
-
I have recently been messing around with the
turtle
module 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. Theonclick()
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)?Code:
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.
https://forum.omz-software.com/topic/5014/shape-method-for-turtle-py