Presentation is loading. Please wait.

Presentation is loading. Please wait.

Turtle Graphics Just keep swimming …. Fill Shapes turtle.fillcolor(“#color_code”) turtle.begin_fill() turtle.end_fill() ■You must tell turtle when to.

Similar presentations


Presentation on theme: "Turtle Graphics Just keep swimming …. Fill Shapes turtle.fillcolor(“#color_code”) turtle.begin_fill() turtle.end_fill() ■You must tell turtle when to."— Presentation transcript:

1 Turtle Graphics Just keep swimming …

2 Fill Shapes turtle.fillcolor(“#color_code”) turtle.begin_fill() turtle.end_fill() ■You must tell turtle when to begin filling and when to end. ■If you decide to end filling the shape before actually reaching your original destination, it will assume a shape from your final point to the original point.

3 Show/Hide Turtle turtle.hideturtle() turtle.showturtle() turtle.shape(“object”) ■You can change your cursor’s shape to be a “turtle”, “square”, “circle”, “arrow”, “triangle”, “classic”

4 Speedy Gonzalez ■Maybe the speed function isn’t fast enough for you … turtle.tracer(0) # put # program # here turtle.update()

5 Writing on Turtle turtle.write(“string”, font = (“font type”, size, “style”) ■Your text will appear wherever your turtle is ■Takes multiple arguments but this is standard ■First, type in string literal as message ■Then define font by: -type (Arial, Times New Roman, etc.) # in quotes -size (integer) -style (normal, bold, italic, bold italic) # in quotes

6 Change Pensize ■You can change the thickness of your lines ■This function takes a single integer argument from 1 to however big you want the pen thickness turtle.pensize(integer)

7 Clear the Stage ■You can use this command to clear your canvas in the middle of your program and start all over turtle.clear()

8 Turn Your Turtle STRAIGHT ■We’ve seen turtle turn right or left by a number of degrees but you can also set the heading by an exact degree point by this function: turtle.setheading(degrees)

9 Renaming Your Module t = turtle.Turtle() t.forward() t.goto() t.penup()

10 Naming Your Turtles ■You can make multiple turtles at a time! ethan = turtle.Turtle() brian = turtle.Turtle() ethan.goto(100,100) brian.goto(150, 50)

11 Screen Adjustments ■You can make multiple turtles at a time! screen = turtle.Screen() screen.bgcolor(“color_code”) screen.setworldcoordinates(min_x, min_y, max_x, max_y)


Download ppt "Turtle Graphics Just keep swimming …. Fill Shapes turtle.fillcolor(“#color_code”) turtle.begin_fill() turtle.end_fill() ■You must tell turtle when to."

Similar presentations


Ads by Google