Introduction to Computer Science – Chapter 8 CSc 2010 Spring 2011 Marco Valero.

Slides:



Advertisements
Similar presentations
Introduction to PowerPoint
Advertisements

Chapter 6 Objects and Classes F OO Programming Concepts F Creating Objects and Object Reference Variables –Differences between primitive data type and.
Graphics Shapes. Setup for using graphics You have to import the graphics library You can use either “import graphics” or “from graphics import *” or.
Neal Stublen Course Road Map  Create web page layouts using CSS  Manage CSS  Test website validity  Create navigation menus using.
Python Programming, 2/e1 CS177: Programming in Multimedia Objects Recitation Topic: Graphics Library.
Memory Management & Method Calls in Java Program Execution © Allan C. Milne v
How to prepare a PowerPoint presentation
Intro to Robots 8 Sights & Sounds. Intro to Robots Computing is more than Computation So many devices – iPod, digital cameras, etc – use computers to.
Intro to Robots Lab 8. Intro to Robots Exercise 1: Follow the text’s suggestion and Google “color names list” Collect from the list a set of 25 colors.
Text, Masks, and Live Effects – Lesson 41 Text, Masks, and Live Effects Lesson 4.
1 Python Programming: An Introduction to Computer Science Chapter 3 Objects and Graphics.
Introduction to Java Programming, 4E Y. Daniel Liang.
New Data Types in C++ Programs We can specify and implement new data types in C++ using classes  need specification as to how represent data objects of.
How to turn on the robot How to start Bluetooth How to connect to robot How to initialize the robot How to not break the robot Sec Getting Started.
Chapter 4 Objects and Graphics
Python: Graphics
Chapter 5 - Making Music: An On-Screen Piano
Taking Pictures Sec 9-9 Web Design. Objectives The student will: Know how command the scribbler robot to take a picture. Know how to display the picture.
Animation CSC 161: The Art of Programming Prof. Henry Kautz 10/14/2009.
CSC 110 Objects and Graphics [Reading: chapter 4] CSC 110 E 1.
Chapter 5 Graphics.  We’ve been doing command line programming, but now it’s time to try GUI programming—programming in a graphical user interface, using.
Scribbler Music Web Design Notes Your robot can play music by “beeping” the correct notes. Every note in music has a “frequency” – Physics of Frequencies:
Introduction to Computer Science – Chapter 9 CSc 2010 Spring 2011 Marco Valero.
Lecture 15: Intro to Graphics Yoni Fridman 7/25/01 7/25/01.
Week 11. Picture Taking Functions  takePicture(“color” | “gray”) Returns a picture object  Show(picture object) Will show the picture that was taken.
Introduction to Computer Science – Chapter 4 CSc 2010 Spring 2011 Marco Valero.
By Jennifer 2004 Powerpoint presentation Powerpoint presentation An introduction to using powerpoint.
What Is PowerPoint? PowerPoint is a program that allows you to create a computerized presentation using slides.
Some Graphics CS303E: Elements of Computers and Programming.
Soundscapes James Martin. Overview Problem Statement Proposed Solution Solution Created (Modules, Model, Pics) Testing Looking Back See It in Action Q&A.
Chapter 2 part #1 C++ Program Structure
Your robot can play a note by “beeping” Every note in music has a “frequency” – Physics of Frequencies: (
Python Programming, 1/e1 Programming Thinking and Method (5a) Zhao Hai 赵海 Department of Computer Science and Engineering Shanghai Jiao Tong University.
Graphics Concepts CS 2302, Fall /17/20142 Drawing in Android.
Chapter 5 Classes and Methods II Lecture Slides to Accompany An Introduction to Computer Science Using Java (2nd Edition) by S.N. Kamin, D. Mickunas, E.
Introduction to Computer Science – Chapter 5 CSc 2010 Spring 2011 Marco Valero.
Weijie Ming Flinders Project. Outline  Instruction  Research Process Interface Basic Function Import File Save File Display and save content Working.
Microsoft® Small Basic Exploring Shapes Estimated time to complete this lesson: 1 hour.
Animation II: Revenge of the Clones CSC 161: The Art of Programming Prof. Henry Kautz 10/16/2009.
Documenting a function. Documenting a function definition We have a template for information that we need you to put at the top of each function - if.
ISBN Chapter 11 Abstract Data Types and Encapsulation Concepts.
Interaction with Graphics Also displaying GIFs. Text Output on the graphics window There is a class called Text which will put the message on the graphics.
© 2007 Lawrenceville Press Slide 1 Chapter 9 Inheritance  One class is an extension of another.  Allows a class to define a specialized type of an existing.
Python Programming, 2/e1 Python Programming: An Introduction to Computer Science Chapter 4 Objects and Graphics.
1- How to connect the robot to the pc Sec Getting Started 3- How to move the robot Sec Scribbler movements 4- How to make a turn 11- How to.
CSC 1051 – Data Structures and Algorithms I Dr. Mary-Angela Papalaskari Department of Computing Sciences Villanova University Course website:
10. MORE OBJECTS Rocky K. C. Chang October 18, 2015 (Based on from Charles Dierbach. Introduction to Computer Science Using Python and adapted from John.
Python Programming, 2/e1 Python Programming: An Introduction to Computer Science Chapter 4 Objects and Graphics.
Finding Notes on the Guitar Fingerboard There are many relationships that can help you with this task. Visualization is really one of the main keys to.
Power Chords. Here is a basic E form of the power chord (in this case an F power chord at the first fret) Root is on the 6 th string Fret
CS 115 Lecture 7 Graphics – coordinate systems, Text, Entry, aliases Taken from notes by Dr. Neil Moore.
Vahé Karamian Python Programming CS-110 CHAPTER 4 Objects and Graphics.
CS 115 Lecture 6 Graphics Taken from notes by Dr. Neil Moore.
Python Programming, 2/e1 Python Programming: An Introduction to Computer Science Chapter 4 Objects and Graphics Killer cars.
Python Programming: An Introduction to Computer Science
Python Programming: An Introduction to Computer Science
Whole and Half Steps Enharmonics
Graphical Output Graphical Text.
Graphics Part I Taken from notes by Dr. Neil Moore
Graphics Part I Taken from notes by Dr. Neil Moore
CS 115 Lecture Graphics II – coordinate systems, Text, Entry, aliases
Tkinter GUIs Computer Science and Software Engineering
Abstract Data Types and Encapsulation Concepts
CS 115 Lecture Graphics II – coordinate systems, Text, Entry, aliases
Creativity & The greater good
Chapter Seven Constructions and Scale Drawings
Review for Test1.
Class 7 coordinates: pixel and with setCoords aspect ratio Rectangle
Class 6 using the math library
Introduction To Drawings, Saving Drawings Chapter 8 Placing Text
Presentation transcript:

Introduction to Computer Science – Chapter 8 CSc 2010 Spring 2011 Marco Valero

Overview Drawing a canvas Objects and constructors Animation Scope Text and images Sound Scales and making music Songs

Drawing a canvas We’ve seen the canvas before ▫Asking a question ▫Showing a picture myCanvas = GraphWin() ▫myCanvas.close() ▫myCanvas.setBackground(‘white’) myCanvas = GraphWin(‘My Masterpiece’, 200, 300)

Drawing a canvas Uses a grid layout of coordinates for position ▫(0,0) is the top left corner We can create points and lines ▫p = Point(100, 50) ▫p.draw(myCanvas) ▫l = Line(Point(0,0), Point(100, 200)) ▫l.draw(myCanvas)

Objects and constructors We’ve seen this style of functions before ▫myList.append(‘a’) ▫myList.sort(). ( ) Think of variables as an object that encapsulates some data and functionality We construct these objects with special functions called constructors ▫p = Point(100, 50)

Objects and constructors Objects may have many member functions p = Point(100, 50) p.getX() returns 100 p.getY() returns 50 l = Line(p, Point(75,200)) l.getP1().getX() returns? L.getP2().getX() returns?

Animation.undraw() ▫Erases object from the screen Circles are defined as a point with a radius ▫c = Circle(Point(100, 50), 30) ▫c.draw(myCanvas) By using the undraw and draw methods we can animate our graphics

Scope Scope is the ability to ‘see’ or ‘know of’ an identifier in python Scope of an identifier in python is in ‘textual order’, and local to functions A global defined at the top will be visible to all A variable within a function will only be visible to that specific function’s body

Text and images We can create graphic representations of text myText = Text(, ) ▫mytext = Text(Point(50,50), ‘hello world’) ▫mytext.draw(myCanvas) We can also display images ▫myphoto = Image(, )

Sound We have used the beep command ▫beep(, ) We can make our computer beep as well ▫computer.beep(, ) Sorry, no wobble bass electro music

Scales and making music A scale is 12 notes ▫C C#/Db D D#/Eb E F F#/Gb G G#/Ab A A#/Bb B ▫Also known as an octave We can double an octave by doubling the frequency ▫C3 ( ) ▫C4 (261.63) The lowest scribbler can go is A0(27.5 Hz)

Songs We can create a string of notes and durations for myro to play as a song ▫Note1 [Note2] Fraction of a Whole Note ▫‘C5 1;’ readSong( ) ▫Reads a file and returns a song object playSong( ) ▫Plays the given song makeSong( ) ▫Returns a song object based on the string of notes given