Agent P, I have been hearing some rumours about a Python Turtle.

Slides:



Advertisements
Similar presentations
First of all – lets look at the windows you are going to use. At the top you have a toolbar, with all your various tools you can use when customising your.
Advertisements

Polygon from a known side
Chapter 10 Constructions.
Computer Science 1000 LOGO I. LOGO a computer programming language, typically used for education an old language (1967) the basics are simple: move a.
Mrs. Chapman. Tabs (Block Categories) Commands Available to use Script Area where you type your code Sprite Stage All sprites in this project.
Logo Lesson 3 TBE 540 Fall 2004 Farah Fisher. Prerequisites for Lesson 3 Before beginning this lesson, the student must be able to… Use simple Logo commands.
1 Python Programming: An Introduction to Computer Science Chapter 3 Objects and Graphics.
Perimeter and Area Please view this tutorial and answer the follow-up questions on loose leaf to turn in to your teacher.
Yr 9 a computer science Nice to meet you variable challenge! 1.Variable assessment Looping in python 2.Looping assessment Drawing in python using turtle.
Mr. Wortzman. Tabs (Block Categories) Available Blocks Script Area Sprite Stage All sprites in this project.
AP Computer Science Principles Data Abstraction and Procedural Abstraction Curriculum Module.
LOGO SOFTWARE BY: SAVE 9S. INTRODUCTION Logo is a software that can be found at : Shared area> High School > ICT > take home software > LOGO32. This is.
Computer Science 111 Fundamentals of Programming I Introduction to Graphics.
Georgia Institute of Technology Barb Ericson Georgia Institute of Technology May 2006 Teaching Java using Turtles part 2.
Art 321 Lecture 7 Dr. J. Parker. Programming In order to ‘make things happen’ on a computer, you really have to program it. Programming is not hard and.
TURTLE GRAPHICS IP MR. MELLESMOEN. LOGO IN THE 1970’S THERE WAS A SIMPLE BUT POWERFUL PROGRAMMING LANGUAGE CALLED LOGO THAT WAS USED BY A FEW.
Introduction to TouchDevelop
Hello, little turtles. Hello, little turtles! There are many modules in Python that provide very powerful feature that we can use in our own program.
MSW Logo By Awin 9s.
Logo For beginners By Dali Matthews 9S What is logo?
Logo Programming Fall 2011 – Session 4 Programming Class Teacher: M. Taghizadeh Sobhan Highschool.
How to link the robot and the computer (Bluetooth) How to turn on and off How to connect the adaptor Fluke card connection Sec Getting Started How.
Section 1 Introduction National 4/5 Scratch Course.
CONTROL SYSTEMS Control Systems A command is a directive that performs a specific task An argument is a variable that can be used by the function reveiving.
Java Introduction part 2 CSC1401. Overview In this session, we are going to examine some of the instructions from the previous class in more detail.
Making Python Pretty!. How to Use This Presentation… Download a copy of this presentation to your ‘Computing’ folder. Follow the code examples, and put.
Loops & Graphics IP 10 Mr. Mellesmoen Recall Earlier we wrote a program listing numbers from 1 – 24 i=1 start: TextWindow.WriteLine(i) i=i+1 If.
To begin click: File, New, then select Design Familiarize yourself with the controls on the page. Then use the maximise button the make the window fill.
5th Grade One Point Perspective shapes Materials –White paper (12x18 cut down to 12x12) –newsprint paper –18” ruler –triangle (in drawer w/rulers) –No.
By Liam Lane How To Use MSW LOGO.
1 Project designed and created by M. Shajith Kumar.
Let’s Learn 3. Modules Saenthong School, January – February 2016
Increase the number of lines before coming back to the origin … triangle square Draw a circle.
First of all – lets look at the window’s you are going to use. At the top you have a toolbar, with all your various tools you can use when customising.
Turtle Graphics Let’s see what we can draw on Python!
Turtle Graphics Lesson 2 1. There are 3 homeworks to complete during the six lessons of this unit. Your teacher will let you know when a homework has.
What does this do? Pen up? Pen Down? Clear? Set Pen Color? Set Pen Shade? Stamp? 1.
Search for it on your computer
LOGO WHAT IS IT? HOW TO USE IT AND HOW USEFUL CAN IT BE?
What is it? How to use it and how useful can it be?
Using the Python Turtle
Python Turtle Graphics
Computer Programming.
MOM! Phineas and Ferb are … Aims:
Graphics CIS 40 – Introduction to Programming in Python
Week 3 DO NOW QUESTIONS.
LOGO BY Kaotip 9S.
LOGO 32 By: Xenon 9S.
Intro CS – Loops & Creating Shapes
What you asked me to teach…
UNIT 3 – LESSON 5 Creating Functions.
Agent P, I have been hearing some rumours about a Python Turtle.
Learning to program with Logo
CS 100: Roadmap to Computing
Module 2 Lesson 3 Over and Over Again
Teaching Java using Turtles part 2
CISC101 Reminders Quiz 2 this week.
Chap. 3 Functions Start Python IDLE (Shell) and open a new file.
Section 3 Programming with Turtle Graphics
Mod 2 Lesson 2 Repeating Debugging
Mod 2 Lesson 2 Repeating with loops
CISC101 Reminders Assignment 2 due this Friday.
Logo Programming.
Module 2 Lesson 3 Over and Over Again
Mod 2 Lesson 2 Repeating with loops
Module 2 Lesson 3 Over and Over Again
Teaching Java using Turtles part 2
Background for lab: the ord() function
Bell Work Title: Turtle Intro Date:
Presentation transcript:

Agent P, I have been hearing some rumours about a Python Turtle. Please find it and invite it to join O.W.A.C.A.! Aims: For students to gain some experience wth Python's turtle module. Objectives: ALL: Use the turtle module in the interpreter. MOST: Experiment with simple drawings using turtle. SOME: Make simple programs using the turtle module and explore some of its more advanced features.

Have a go at using these basic commands. First we create an instance of the Turtle class. I called it 'a', you can call it what you like. Then we can use the dot notation to invoke the turtle's methods. a.fd(n) -> go forward n pixels. a.lt(n) -> turn left n degrees. a.color(n) -> change the color of the line. a.home() -> go back to 0,0. a.pensize(n) -> change the width of the line. a.up() -> take the pen off the paper.

Have a play with the turtle object. Can you work out how to ... ? -> turn right -> go back -> put the pen down again Mini Tasks In the interpreter: -> draw a triangle -> draw a pentagon -> draw a circle (don't use the built-in method). If you have used Scratch, the turtle module may seem familiar to you. They are both descended from the LOGO programming language.

The center of the turtle's window is 0,0. You can use the “goto” method to move the turtle to a position on the screen by its co-ordinates. The center of the turtle's window is 0,0. You can write words in the turtle window. You can also change the turtle to a turtle shape and stamp an imprint on the screen. If you type the name of your turtle object and a dot, IDLE will show you a list of methods that you could invoke. Have a play and find out what some of them do.

If you succeeded with the triangle and pentagon scripts, you probably noticed that you could generalise the procedure. And a circle is just a polygon with very many sides ....

I asked the program to draw a polygon with 360 sides, all of length 1. Task: For the next activity, we need a function that will draw a quarter of a circle. See if you can work this out for yourself. If you can, I want something that will draw this shape. It is just two quarter-circles facing one another.

Turtle Challenge Once you have the “petal” shape function, you should be able to write a program that draws flowers like this. Choose some nice colours and vary the number of “petals” in the flower until you find a design that you like.

Only if you are stuck ... Here's a possible quarter-circle function. circumference = π * 2 * radius We are going to draw the arc in steps corresponding to one degree. Let's call the length of these “step”. step = (π * 2 * radius) / 360 step = 0.01745 ... For my version, I decided that 0.02 was close enough.

Using fill Just use begin_fill() before you start drawing the shape you want to fill. Then, use end_fill() and the shape will be filled for you.

Task: Have a play with that filled square routine. If you alter the amount of turn you can write a function that produces results similar to these. You'll probably want to use a while loop. How will your program know when it is time to stop?