Python Turtle And The Cartesian Plane
The difference between a Python screen and a turtle screen

In this article we introduce Idle and the cartesian plane. We talk about the difference between the Idle screen, the Python screen and the turtle screen and we highlight the difference between print and write.
The first screen that you see when working in Python is the script writing screen. In our case it is Idle named after Eric Idle who was a script writer for Monty Python. It is also an acronym for Integrated Development and Learning Environment.
An integrated development environment or IDE is the script writing tool associated with a language. Idle is a simple IDE that is bundle with the application. When you download turtle you usually download Idle as well.
When you write a program you normally see the Python screen with content of what you have written printed on the screen.
What you see in Idle is
print ("Hello World!")What you see on the Python screen is
Hello World!
This will appear on the upper left hand corner of the screen. A carriage return is also generated and the next thing you print will be on the line immediately below.
When you run a program containing turtle commands. A different screen opens up.
This is a GUI or graphical user interface.
The python screen is designed to work primarily with text.
The turtle screen is designed to work primarily with graphics.
To understand the turtle screen you need to know a little bit about the cartesian plane.
The cartesian plane was developed by the mathematician and philosopher Rene Descartes to display numbers graphically with ordered co-ordinates.
Cartesian co-ordinates are an essential tool for most applied disciplines that deal with geometry, including astronomy, physics, and engineering. They are used in computer graphics, computer-aided geometric design and other geometry-related data processing
The cartesian plane has vertical and horizontal axises called the x axis and the y axis Which divide the screen into four quadrants with the middle point being 0,0.
Any two positive numbers will lie in the upper right hand quadrant.
Any two negative numbers will lie in the lower left hand quadrant.
Any two numbers that are negative and positive will line in the upper right hand quadrant.
Finally any two numbers that are positive and negative will line in the lower right hand quadrant.
To illustrate I have drawn the x and y axises and randomly generated four pairs of numbers for each of the quadrants and plotted them turtle screen.

Here is the code
import turtle as T
import randomT.forward (900)
T.back (1800)
T.home()
T.left (90)
T.forward (400)
T.back (800)
T.home()T.penup()
x = random.randrange(10,201)
y = random.randrange (10,201)
T.goto (x,y)
T.dot()
T.write (x,font =("Arial",12,"normal") )
T.forward (40)
T.write (y,font =("Arial",12,"normal") )x = random.randrange(-201,-10)
y = random.randrange (10,201)
T.goto (x,y)
T.dot()
T.write (x,font =("Arial",12,"normal") )
T.forward (40)
T.write (y,font =("Arial",12,"normal") )x = random.randrange(10,201)
y = random.randrange (-201,-10)
T.goto (x,y)
T.dot()
T.write (x,font =("Arial",12,"normal") )
T.forward (40)
T.write (y,font =("Arial",12,"normal") )x = random.randrange(-201,-10)
y = random.randrange (-201,-10)
T.goto (x,y)
T.dot()
T.write (x,font =("Arial",12,"normal") )
T.forward (40)
T.write (y,font =("Arial",12,"normal") )T.hideturtle()If you want to put some text on the turtle screen the command is write.
import turtle as T
T.write ("hello world!")This will place the phrase hello world! at the current location of the cursor. When you start the cursor is in the center of the screen. The x y coordinates are 0,0. If you tried the following
import turtle as T
T.write ("hello world!")
T.write ("spam")spam would overwrite hell and make it indescifrable and 0 world! would remain.
With turtle when you use write you have to specify the location. Otherwise it will just write at the current location of the turtle.
Jim McAulay🍁 says “I think my children are spoiled. They are beginning to smell bad”
70–67







