Begin forwarded message:
> From: Hershel Millman <hers...@themillmans.net> > Date: June 18, 2016 2:39:21 PM MST > To: Steven D'Aprano <st...@pearwood.info> > Subject: Re: [Tutor] Turtle > > Steven, > > I followed your instruction and typed "import turtle" into the terminal on my > mac, and nothing happened. > > When I entered the following, a new window was created in which the turtle > behaved exactly like it was supposed to. > > for i in range(4): > ... turtle.right(90) > ... turtle.forward(200) > > In pycharm, when I enter the following, it replies with the following error > message: > > from turtle import * > > def drawSquare(size=100): > turtle.pendown() > turtle.forward(size) > turtle.left(90) > turtle.forward(size) > turtle.left(90) > turtle.forward(size) > turtle.left(90) > turtle.forward(size) > turtle.left(90) > > drawSquare(50) > > input () > > Traceback (most recent call last): > File "/Users/Hershel/PycharmProjects/Project 1/practicefornotturtle.py", > line 14, in <module> > drawSquare(50) > File "/Users/Hershel/PycharmProjects/Project 1/practicefornotturtle.py", > line 4, in drawSquare > turtle.pendown() > NameError: global name 'turtle' is not defined > > Process finished with exit code 1 > > Thank you, > > Hershel > > On Jun 18, 2016, at 2:00 AM, Steven D'Aprano wrote: > >> 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@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 >> _______________________________________________ >> Tutor maillist - Tutor@python.org >> To unsubscribe or change subscription options: >> https://mail.python.org/mailman/listinfo/tutor > _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor