4 ms·
I'm a Python newbie, running on macOS 10.13 with Python 2.7.10. When I save the above as turtle.py, and run with `python turtle.py` in the Terminal, I see an al
by SamBam 7y ago
I'm a Python newbie, running on macOS 10.13 with Python 2.7.10. When I save the above as turtle.py, and run with `python turtle.py` in the Terminal, I see an almost instantaneous flash of a tiny window, which then disappears.
When I remove the tracer line to "watch the drawing," I don't even get that. The Terminal just returns instantly.
Looking at tracer documentation, it's supposed to be `(which-frames-to-render, delay)`. If I set it to `turtle.tracer(1, 10000)` I get exactly the same flashing window as (0,0).
How can I see the result?
- hackyhacky 7y agoDon't save the file to turtle.py, because then the "import turtle" line might try to import itself. Call it turtlestuff.py. Then do this in terminal: python -i turtlestuff.py Then you'll get an interactive Python prompt and you can call the functions directoy, e.g. spirals() Hope this helps you!
- SamBam 7y agoAh, thank you.
- DonHopkins 7y ago>because then the "import turtle" line might try to import itself Then you get turtles all the way down!
- hackyhacky 7y agoAlternatively, if you save the file as turtlestuff.py, you can run this: python -c 'from turtlestuff import *; snowflakes(); turtle.mainloop()' or python -c 'from turtlestuff import *; snowflakes(3); turtle.mainloop()' or python -c 'from turtlestuff import *; orb(); turtle.mainloop()'