Graphics Michael Liut ( ) Ming Quan Fu( ) Brandon Da Silva(

Slides:



Advertisements
Similar presentations
Graphics Shapes. Setup for using graphics You have to import the graphics library You can use either “import graphics” or “from graphics import *” or.
Advertisements

Graphics You draw on a Graphics object The Graphics object cannot directly be created by your code, instead one is generated when the method paintComponent.
Python Programming, 2/e1 CS177: Programming in Multimedia Objects Recitation Topic: Graphics Library.
Definition: Domain The domain of a function is the set of all x-values. Since the x-values run from left to right in the coordinate plane, we read the.
Lesson 6.4 Midpoint Formula & Partitions Concept: Partitions EQ: How do we partition a line segment in the coordinate plane? (G.GPE.6) Vocabulary: Midpoint,
ObjectDraw and Objects Early Chris Nevison Barbara Wells.
Chapter 3 - Introduction to Java Applets Outline 3.1Introduction 3.2Thinking About Objects 3.4A Simple Java Applet: Drawing a String 3.5Two More Simple.
Four simple expressions in meta. Data objects Pieces of data in a computer are called objects Today, we’ll talk about four kinds of objects Numbers Pictures.
A Simple Applet.
1 Python Programming: An Introduction to Computer Science Chapter 3 Objects and Graphics.
Graphics - setCoords. The coordinate system of Zelle graphics The default coordinate system for GraphWin is that the origin is in the upper left hand.
Chapter 4 Objects and Graphics
Python: Graphics
 Computer Science 1MD3 Introduction to Programming Michael Liut Brandon Da Silva
 Computer Science 1MD3 Introduction to Programming Michael Liut Ming Quan Fu Brandon.
Lesson 2-3: Piecewise and Absolute Value Functions
Addison Wesley is an imprint of © 2010 Pearson Addison-Wesley. All rights reserved. Chapter 2 Graphics Programming with C++ and the Dark GDK Library Starting.
 Computer Science 1MD3 Introduction to Programming Michael Liut Brandon Da Silva
Lesson 7 Rectangular Objects. Rectangle Command Rectangles with Vertices on the Origin Start from the origin End at the origin.
Graphic Basics in C ATS 315. The Graphics Window Will look something like this.
Some Graphics CS303E: Elements of Computers and Programming.
GRAPHICS MODULE 14 STUDY BOOK. Graphic commands SCREEN - puts the screen into graphics mode WINDOW - allows scaling of the screen LINE - 3 formats –LINE.
 Computer Science 1MD3 Introduction to Programming Michael Liut Ming Quan Fu Brandon.
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.
Introduction to Matlab Module #10 Page 1 Introduction to Matlab Module #10 – Creating Graphical User Interfaces Topics 1.Overview of GUI Development using.
Python Programming, 2/e1 Python Programming: An Introduction to Computer Science Chapter 4 Objects and Graphics.
Equations of Circles. You can write an equation of a circle in a coordinate plane, if you know: Its radius The coordinates of its center.
5. COMPUTING WITH GRAPHICS OBJECTS Dennis Y. W. Liu and Rocky K. C. Chang October 8, 2015 (Adapted from John Zelle’s slides)
CS 115 Lecture 7 Graphics – coordinate systems, Text, Entry, aliases Taken from notes by Dr. Neil Moore.
CS 115 Lecture 6 Graphics Taken from notes by Dr. Neil Moore.
8.1 The Rectangular Coordinate System and Circles Part 2: Circles.
ENGINEERING 1D04 Tutorial 4. What are we doing today? Focus Functions Scope of Variables Returning Values Objects Graphics library Aliasing Events Mouse.
Graphics Taken from notes by Dr. Neil Moore & Dr. Debby Keen
GUI in Python Ismail Abumuhfouz.
Equations of Circles.
Circles in the Coordinate Plane
Catapult Python Programming Session 4
Chapter 3 Syntax, Errors, and Debugging
Workshop 3.1 Sketching DesignModeler.
Equations of Circles.
Python: Simple Graphics and Event-driven Programming
Graphics Part I Taken from notes by Dr. Neil Moore
def plotDrugData4(data, data1, color, name, name1): plot(data, data1, color) show() xlabel(name) ylabel(name1) title(name + ' versus ' + name1)
Graphics Part I Taken from notes by Dr. Neil Moore
CS 115 Lecture Graphics II – coordinate systems, Text, Entry, aliases
Introduction to Graphing
Lesson: 10 – 8 Equations of Circles
CS 115 Lecture Graphics II – coordinate systems, Text, Entry, aliases
Circles 4.1 (Chapter 10). Circles 4.1 (Chapter 10)
Review Circles: 1. Find the center and radius of the circle.
What is a radius of a circle? What about the diameter?
11.7 Circles in the Coordinate Plane
Equations of Circles.
Chapter 2 Graphics Programming with C++ and the Dark GDK Library
EXAMPLE 2 Find lengths in circles in a coordinate plane
Graphics Part I Taken from notes by Dr. Neil Moore
9.3 Graph and Write Equations of Circles
Test Dates Thursday, January 4 Chapter 6 Team Test
Circles in the Coordinate Plane
10-7: Write and Graph Equations of Circles
Simple Graphics Package
Topics Graphical User Interfaces Using the tkinter Module
Introduction to Turtle Graphics
Chapter 9 Section 8: Equations of Circles.
Class 7 coordinates: pixel and with setCoords aspect ratio Rectangle
Class 6 using the math library
Just Basic Lesson 15 Mr. Kalmes.
Warmup Find the distance between the point (x, y) and the point (h, k).
Graphing on a Coordinate plane
JavaScript – Let’s Draw!
Presentation transcript:

Graphics Michael Liut ( ) Ming Quan Fu( ) Brandon Da Silva( )

Graphics Package To use graphics, you first need to import it as it is a library To use graphics, you first need to import it as it is a library import graphics import graphics To actually use a GUI window, you will need to open it up To actually use a GUI window, you will need to open it up window = graphics.GraphWin() window = graphics.GraphWin() To close a window, use the close command To close a window, use the close command window.close() window.close()

Graphics Package Since there are many methods inside the graphics library, there are short cuts to reduce the amount of code you type Since there are many methods inside the graphics library, there are short cuts to reduce the amount of code you type Instead of import graphics, use from graphics import * Instead of import graphics, use from graphics import * The * means you are importing everything inside the library The * means you are importing everything inside the library window = GraphWin() window = GraphWin()

Graphics Package The default GUI window has a display size of 200px (length) by 200px (height) The default GUI window has a display size of 200px (length) by 200px (height) Think of the GUI window as a graph with each pixel representing one unit Think of the GUI window as a graph with each pixel representing one unit Only be one coordinate plane Only be one coordinate plane The origin (0, 0) is the upper left corner The origin (0, 0) is the upper left corner X-Value increases as you move right X-Value increases as you move right Y-Value increases as you move down Y-Value increases as you move down

Graphics Package A point is just a pixel on the GUI A point is just a pixel on the GUI To create a point… To create a point… varName = Point (x, y) varName = Point (x, y) varName is the variable name varName is the variable name x is the value of the x coordinate x is the value of the x coordinate Y is the value of the y coordinate Y is the value of the y coordinate point1 = Point (100, 100) point1 = Point (100, 100) After creating the point, you must display it After creating the point, you must display it point1.draw(window) point1.draw(window)

Graphics Package varName = Circle(Point(x,y), r) varName = Circle(Point(x,y), r) varName is the name of the circle varName is the name of the circle Point(x, y) is the center of the circle Point(x, y) is the center of the circle r is the radius r is the radius varName = Text(Point(x, y), text) varName = Text(Point(x, y), text) varName is the name of the text varName is the name of the text Point(x, y) is the center of the text Point(x, y) is the center of the text text is a string denoted with double quotations text is a string denoted with double quotations

Graphics Package varName = Rectangle(Point1(x,y), Point2(x, y)) varName = Rectangle(Point1(x,y), Point2(x, y)) varName is the name of the rectangle varName is the name of the rectangle Point1(x, y) is the point of the upper left corner Point1(x, y) is the point of the upper left corner Point2(x, y) is the point of the lower right corner Point2(x, y) is the point of the lower right corner varName = Line(Point1(x, y), Point2(x, y)) varName = Line(Point1(x, y), Point2(x, y)) varName is the name of the line varName is the name of the line Point1(x, y) is the point of one of the endpoints Point1(x, y) is the point of one of the endpoints Point2(x, y) is the point of the other end point Point2(x, y) is the point of the other end point Remember to display all your objects! Remember to display all your objects!

Graphics Example 1

Graphics Example 1 - RUN

Graphics Example 2

Graphics Example 2 - CTD

Graphics Example 2 - RUN

Graphics Example 2 - RUN

Graphics Example 2 - RUN

Graphics Example 2 - RUN

Graphics Example 2 - RUN Graphics window was terminated. Graphics window was terminated.

setCoords Explanation b-3a90ff183423/Lectures/Zelle%20-%20Chapter%2005.pdf

Graphics - Assignment 3 Due: Thursday March 13, 2014 BY 11PM Due: Thursday March 13, 2014 BY 11PMExpectations: Follow the format specified in the assignment. Follow the format specified in the assignment. Read the assignment very carefully. Do NOT assume, if you are unsure ask! Read the assignment very carefully. Do NOT assume, if you are unsure ask! Proper naming, use of functions, etc… Proper naming, use of functions, etc… YOU MUST COMMENT ALL YOUR CODE! YOU MUST COMMENT ALL YOUR CODE!

Link to Guide On my website: On my website: This package includes descriptions of how to use the graphics functions (included in graphics.py). This package includes descriptions of how to use the graphics functions (included in graphics.py).