1 / 11

Programming for GCSE Topic 8.3: Python Turtle Graphics

T eaching L ondon C omputing. Programming for GCSE Topic 8.3: Python Turtle Graphics. William Marsh School of Electronic Engineering and Computer Science Queen Mary University of London. Aims. Outline the idea of turtle graphics Evaluate turtle graphics for learning programming.

jgeoffrey
Download Presentation

Programming for GCSE Topic 8.3: Python Turtle Graphics

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. TeachingLondon Computing Programming for GCSETopic 8.3: Python Turtle Graphics William Marsh School of Electronic Engineering and Computer Science Queen Mary University of London

  2. Aims • Outline the idea of turtle graphics • Evaluate turtle graphics for learning programming

  3. Principles of Turtle Graphics

  4. from turtle import * pencolor('red') pensize(5) fillcolor('yellow') begin_fill() forward(80), left(120) forward(80), left(120) forward(80), left(120) penup() forward(150) circle(80) end_fill() done()

  5. from turtle import * pencolor('red') pensize(5) fillcolor('yellow') begin_fill() forward(80), left(120) forward(80), left(120) forward(80), left(120) penup() forward(150) circle(80) end_fill() done() Pen size and colour Turtle movement Fill– start and end Stop drawing

  6. Documentation • See chapter 23 of Python library • Functions: simpler, as shown • Object-orient methods: more flexible • Simplified extract in the practical sheet • Omits synonyms • More complex features

  7. How Useful Is Turtle Graphics? Could use turtle graphics as an introductions

  8. Advantages • Visual • Picture and simple animation • Text I/O included • Not really for graphical UI or games • Problem solving and creativity • Functions • Obvious need for decomposition into functions

  9. Limitations • Less focus on variables: very important concept • Many problems can be solved (badly) without control structures (if and loops) • Not a great match to GCSE syllabus

  10. Example Challenge Problems • Handle shapes as data • Save in file • E.g. ['square', 100, 30, 40] – size, x, y • Do transformations on shapes • Rotate • Reflect • Display data • E.g. bar or line graph

  11. Summary • Turtle graphics is simple and visual • Consider it as an alternative route for transition between visual (e.g. Scratch) and textual programming

More Related