Forum Archive

Working with Turtle in Pythonista

rex_noctis

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. 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)?

Code:

from turtle import *

speed(0)
screen = Screen()

def moveTo(x, y):
     setpos(x, y)

screen.onclick(moveTo)
screen.listen()
mikael

@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.

ellie_ff1493

You can override the screens tap

S = getscreen()
S.touch_enabled = True
S.touch_began = myfunktionname
JonB

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