[Tutor] Turtle
Steven D'Aprano
steve at pearwood.info
Sat Jun 18 05:00:19 EDT 2016
On Fri, Jun 17, 2016 at 11:25:40PM -0700, Hershel Millman wrote:
> Hello tutors,
>
> I have been learning basic python on my Macintosh computer and
> everything I have tried so far has worked, except when I tried to use
> the turtle module. I then used my Linux computer and the turtle module
> still did not work.
What does "did not work" mean?
Did you get an error message? Blue Screen Of Death? Computer caught
fire?
I see later on that you are running PyCharm. Let's try this with the
default Python interpreter. Open a terminal window. You should see a
prompt ending with a dollar sign $ e.g. on my computer I see:
[steve at ando ~]$
Type the command "python" without quotes, and hit Enter. You should get
a message about the version of Python you are running, and a >>> prompt.
This is the Python interpreter. Now enter:
import turtle
What happens? Do you get an error?
If not, what happens if you enter these lines?
turtle.shape('turtle')
for i in range(4):
turtle.right(90)
turtle.forward(200)
(Hit the TAB key at the beginning of the last two lines to get the
indent. When you have finished typing, you will need to enter one extra
time to have Python run the code.)
Describe what happens. Do you get an error? If you do, copy and paste
the ENTIRE error message, starting with the line "Traceback".
> I tried to use the command line and type "sudo dnf
> install turtle", "sudo pip install turtle", and it told me "no package
> turtle available".
That's because turtle is part of the standard library. It's already
installed. If you run:
locate turtle.py
from your Linux or Mac OS X shell (not from Python!) you should see a
list of at least one turtle.py files.
> I tried to install Python-tk and python3-tk, and I
> was told that no packages by those names were available. I also tried
> reinstalling python 2 and python 3, to no avail.
Reinstalling Python should be the *last* resort, not the first, or
second.
--
Steve
More information about the Tutor
mailing list