Drawing with Tracy in Python 2 Tracys First














- Slides: 14

Drawing with Tracy in Python

2: Tracy’s First Letter Click Run Code every time your change your code to see what happens Change 1 number at a time to see how that changes the drawing Tracy makes Code Challenge: 1. Can you make the length of the T shorter? The pendown() command tells the turtle to draw a line 2. Can you make the top of the T shorter? 3. Can you make the T appear closer to the left side of the screen? *this will require more than changing numbers 4. Can you make the T appear closer to the top of the screen? The degrees after left and right tell the turtle how far to turn How does knowing how to graph points on a coordinate plane help coders move Tracy? These #s change how far the turtle travels

Changing this # changes the length of the vertical line 2: Tracy’s First Letter Code Challenge Key 1. Making the length of the T shorter

First, change the starting position of the turtle Second, change the length of the horizontal line. The length of the line should be 2 X the number on line 15 to make the T even. 2: Tracy’s First Letter Code Challenge Key 2. Making the top of the T Shorter

These commands move the turtle closer to the left side of the screen before drawing A second possible solution 2: Tracy’s First Letter Code Challenge Key 3. Making the T appear closer to the left side of the screen (for this to work you will need to add more lines of code)

One option is to change how far from (0, 0) the turtle moves before drawing the horizontal line 2: Tracy’s First Letter Code Challenge Key 4. Making the T appear closer to the top of the screen

3: Draw your first letter Challenge: • Paste your code in the chat or discussion post for your peers to review • Use the commands to the right to draw your letter • Can you draw 2 letters? Debugging: check capitalization, parentheses, and make sure each command is on a new line

4: Tracy’s Bubble Letter Challenge: • Can you modify the code, so the T is wider? • Your T should look similar to the result to the right • When everyone has finished, share your code with the class! Debugging: check capitalization, parentheses, and make sure each command is on a new line

5: Draw a Bubble Letter Using the commands we’ve learned, draw the first letter of your name! Before you begin to type your code, draw your bubble letter in Class Notebook and write down the steps Tracy the turtle will need to take to trace each line segment. Example (using letter T): 1. draw a (short) horizontal line 2. Turn right 90 degrees 3. Draw a longer vertical line 4. Turn left 90 degrees 5. Draw a medium horizontal line etc. Then type your code, if the order is correct but the lengths are off, you can easily adjust your code until you have created your letter. Or you can adjust the order of your code as needed. Once you have a program, you’re happy with, make sure to copy your code into the teams chat to use in the next exercise (and test your friends code, try to guess what letter they drew before you click run code!). If you don’t copy it, you’ll lose all of the awesome work you just did! To copy your code: Highlight the code and right click, select “copy” To paste your code: In the teams chat right click and select “paste”

7: Tracy’s Letter T with Color Challenge: • Can you change the outline color to green and the inner color to pink? • What happens if you move the end_fill() command to somewhere else in the code? • What happens if you move the begin_fill() code?

7: Tracy’s Letter T with Color SAMPLE CODE Challenge: • Challenge code answer By changing the color to pink just before the end_fill() command you can change the interior. If you try to enter the command earlier, it will change the outline color as well.

8: Color your bubble Letter! Draw your bubble letter in code and change the outline and fill colors. Once you have a program you’re happy with, make sure to copy your code and paste it into the team's chat (or canvas discussion post)! If you don’t copy it, you’ll lose all the awesome work you just did! Take a screen shot of your work and post it with the #CSEd. Week 2020 DCPS

Bonus! Artistic Effects • Explore example 12: Tracy’s Decorated Letter T and examples 13: Fancy Letter ‘a’ • Change the colors and the thickness of the outlines or background color and see if you can add shapes! • Copy and paste a screen shot of your changes into your class’s Teams chat • It’s ok if you don’t understand everything the code is doing in example 12, it is a complicated program. If you “break” the code, just go back to the pervious screen and the code will be reset.

14: Create Your Masterpiece! Using all the commands we’ve learned, create a masterpiece of the first letter of your name. Here are some tips to get started: • Draw out your artwork on graph paper before writing any code. Note any important coordinate points and lengths Tracy will have to move. • Remember that you can get a curved end by drawing a line with a larger pensize OR by using the advanced circle command (circle(radius, extent)). • You can fill in your shape by using the begin_fill() command before Tracy starts moving and then the end_fill() command after the shape is drawn. • To add a background color to your canvas, move Tracy to the bottom left corner of the canvas, set your color, use the begin_fill() command move Tracy in a square around the edge of the canvas. Be sure to use the end_fill() command when Tracy gets back to the bottom left corner! • Each Tracy command builds on top of one another in order so if you draw a circle first and then a square after, the square will show up on top of the circle. Once you have a program you’re happy with, make sure to copy your code and paste it into the team's chat (or canvas discussion post)! If you don’t copy it, you’ll lose all the awesome work you just did! Take a screen shot of your work and post it with the #CSEd. Week 2020 DCPS