Introduction To Programming - Python
Introduction To Programming - Python
Introduction To Programming - Python
import turtle!
turtle.exitonclick()!
+
The Turtle Canvas
+
Basic Drawing
turtle.forward(pixels)
And you can have your turtle turn by using the following
commands:
turtle.right(degrees)
turtle.left(degrees)
turtle.goto(50,50)!
Note that your pen will continue to draw as you move your
turtle to a new position.
By default your turtle will draw solid black lines on the canvas
The color value can be a standard Red Green Blue (RGB) color
code. Here’s an example:
RGB color codes define how much red, green and blue
should be mixed into a given color
They are divided into three channels – one for red, one for
green and one for blue, in that order
Counting in hex:
0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F,10
11,12,13,14,15,16,17,18,19,1A,1B,1C,1D,1E,1F,20
+
RGB Color
If you are drawing closed polygons you can tell Python to fill
them with an RGB color by calling the turtle.fillcolor()
function. This function takes one argument – a color value.