Python Turtle Graphics

Slides:



Advertisements
Similar presentations
Do Now:.
Advertisements

COMPSCI 105 S Principles of Computer Science
Cosc 1P02 Week 2 Lecture slides
"Turtle Graphics“ for kids.
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.
Fundamentals of Python: From First Programs Through Data Structures
Programming in Python Turtle Graphics Dr. Kristine Nagel Genie Yang Raquel Lawrence Dr. Kristine Nagel Genie Yang Raquel Lawrence Georgia Gwinnett College.
B.A. (Mahayana Studies) Introduction to Computer Science November March Logo (Part 1) An introduction to Logo: drawing, moving,
Log on and Download from website:
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.
Graphics and Procedures Programming Right from the Start with Visual Basic.NET 1/e 5.
Fall Week 3 CSCI-141 Scott C. Johnson.  Say we want to draw the following figure ◦ How would we go about doing this?
Microsoft® Small Basic
Computer Science 111 Fundamentals of Programming I Introduction to Graphics.
Main Points: - Python Turtle - Fractals
Georgia Institute of Technology Barb Ericson Georgia Institute of Technology May 2006 Teaching Java using Turtles part 2.
A SIMPLE COMPUTER LANGUAGE LOGO. LOGO Introduction Logo is the simplest programming language. It.
Class 2 Introduction to turtle graphics
Turtle see, turtle do Lesson 1 – Welcome to LOGO.
A new human-computer interface?
Agent P, I have been hearing some rumours about a Python Turtle.
1 Turtle Graphics and Math Functions And how you can use them to draw cool pictures!
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?
Moving Sprites in Scratch Exploring Computer Science – Lesson 4-4.
The Hare Raising Experience of Logo in the Classroom
Rotations.
GRAPHICS MODULE 14 STUDY BOOK. Graphic commands SCREEN - puts the screen into graphics mode WINDOW - allows scaling of the screen LINE - 3 formats –LINE.
By Liam Lane How To Use MSW LOGO.
Getting started with the turtle Find the latest version of this document at
Moving Sprites in Scratch Exploring Computer Science – Lesson 4-4.
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.
Today… The for loop. Introducing the Turtle! Loops and Drawing. Winter 2016CISC101 - Prof. McLeod1.
Search for it on your computer
Chapter 11 Enhancing an Online Form and Using Macros Microsoft Word 2013.
Using the Python Turtle
Fundamentals of Programming I Introduction to Graphics
Graphics CIS 40 – Introduction to Programming in Python
Intro CS – Loops & Creating Shapes
Lab 9 Intro to Robots.
Fundamentals of Programming I Introduction to Graphics
A Tiny Look at the Graphics Window
Agent P, I have been hearing some rumours about a Python Turtle.
Learning to program with Logo
CS 100: Roadmap to Computing
Microsoft® Small Basic
CS 100: Roadmap to Computing
Teaching Java using Turtles part 2
CISC101 Reminders Quiz 2 this week.
Chapter 2 Graphics Programming with C++ and the Dark GDK Library
Chap. 3 Functions Start Python IDLE (Shell) and open a new file.
Moving Sprites in Scratch
Suppressing print Newline
Just Basic Lesson 18 Mr. Kalmes.
Graphics Animation Using Terrapin LOGO
Main Points: - Python Turtle - Fractals
Winter 2019 CISC101 2/17/2019 CISC101 Reminders
Introduction to Turtle Graphics
ICT Gaming Lesson 3.
Institute for Entrepreneurship and Career Development (IECD)
CISC101 Reminders Assignment 2 due this Friday.
A Tiny Look at the Graphics Window
Class 6 using the math library
Mod 2 Lesson 2 Repeating with loops
Teaching Java using Turtles part 2
Background for lab: the ord() function
Using Modules.
Presentation transcript:

Python Turtle Graphics ASFA CS Principles 2015-2016

A first Object: Logo Turtle Dr. Seymour Papert at MIT invented the Turtle as a graphical and mathematical object to think with for the children’s programming language, Logo (1966)

Robot Turtles Children programmed robot turtles to draw pictures

A turtle is an object. Every turtle understands the same methods. Every turtle has the same fields or instance variables. Heading, body color, pen color, X and Y position. Yet each turtle can have its own values for these fields. Many modern programming languages, such as Python, continue to use turtles for drawing

Think of a turtle crawling on a piece of paper, with a pen tied to its tail Sheet of paper is a window on a display screen Position specified with (x, y) coordinates Cartesian coordinate system, with origin (0, 0) at the center of a window

Imagine a turtle starting at (0, 0) Give it the command turtle.forward(15), and it moves (on-screen) 15 pixels in the direction it is facing, drawing a line as it moves. Give it the command turtle.left(25), and it rotates in-place 25 degrees counter-clockwise.

Some Examples of Turtle Programs A forest scene created with turtles http://www.youtube.com/watch?v=Wwzv0FWJ5gQ A Recursive Turtle Drawing Program http://www.youtube.com/watch?feature=player_embedded&v=YummtrvNC2o

Some Key Methods from turtle import * # pen/turtle starts at the center (x=0, y=0) of the turtle display area shape(“turtle”) color("green") # pen up, don't draw up() # centers the circle goto(0,-50) # pen down, draw down() # radius=50 center is 50 radius units above the turtle circle(50) # center the turtle again goto(0,0) tur2.py

Turtle drawing with repetition from turtle import * def star(): color('red', 'purple') colormode(255) begin_fill() for i in range(36): pencolor(3*i + 100, 0 , 5*i) forward(200) left(85) forward(10) left(45) forward(40) left(-90) end_fill() setpos(100,45) color("white","yellow") shape("turtle") star() spyro.py

Recursive Drawing Algorithms Recursive Algorithms are used to create fractals

Documentation available explaining methods available If you have trouble getting the docs from Python, you can go to http://docs.python.org/library/turtle.html

Turtle library contains many methods

Click on method you want to see

Method usage documentation and examples

Endless Artistic Possibilities

What can you create?

Assignment Explore the documentation Design and program a turtle drawing a picture Must include: At least 4 colors At least 4 shapes A filled object Looping Show me the drawing creation Email your program to me after checked off Make a multi-turtle program if you are done