Missing Turtle functionality?
I have been starting to use turtle in my coding class, and one of the commands they demand I use is wn.clearscreen(), something that Pythonista says does not exist. First of all, why does it not exist? Am I missing a library or is the library out of date or something else? Secondly, how can I configure things to allow this argument? Any help would be appreciated, thank you.
@SkiNoCap there is a turtle.clear
Search in doc
@cvp I see that the Pythonista module is not the same as the standard one (including mouse and keyboard interaction which is what S.exitonclick() would be) but S.clear() doesn't do what I want it to, which is to close the UI. I guess there is no alternative though, I'll just have to remember to include S.exitonclick() when I turn in my assignments. Thank you!
try: S.exitonclick() except AttributeError: pass # Workaround for Pythonista
I might be typing it in incorrectly, but when I do I get a syntax error with "except AttributeError". Here's what I typed:
try: wn.exitonclick() except AttributeError: pass
@SkiNoCap you forgot the "try: " line
try: wn.exitonclick() except AttributeError: # <--- the : was forgotten pass # Workaround for Pythonista
@cvp alright so it works without an error, but when I click (tap) on the window it doesn't show any sort of a response (now thinking about it, probably because it's an exception, not running the code - correct me if I'm wrong). Is the effect the same as .exitonclick() when run through another IDE like IDLE? Away from my PC and can't try it right now.
I'll just point out that the turtle module in pythonista is written in pure python (plus the canvas or ui module, I forget which), so can be edited to provide whatever missing functionality you need... Although that may be more effort than you really want!
For instance, see
The cpython turtle module is mostly NOT tkinter -- in theory it shouldn't be too hard to just strip out the tkinter drawing methods with ui.path drawing methods.
If you are trying required to submit programs that work in a particular environment, you probably should make sure that you run your final checks in that
environment -- get yourself a free shell account if you don't have a desktop/laptop. Sagecell also is a way that you can run code in a more standard environment (there are some threads on pythonista and sagecell with a wrench script that lets you run a script edited in pythonista on a sagecell server)