Graphics Lab: MyPaint Dan Maselko 1. MyPaint Description  For this assignment you will be implementing a very simple paint program.  You should be able.

Slides:



Advertisements
Similar presentations
Working with Profiles in IX1D v 3 – A Tutorial © 2006 Interpex Limited All rights reserved Version 1.0.
Advertisements

CATHERINE AND ANNIE Python: Part 3. Intro to Loops Do you remember in Alice when you could use a loop to make a character perform an action multiple times?
ASENT_IMPORT.PPT Importing Board Data Last revised 08/10/2005.
Unit 3 Day 4 FOCS – Web Design. No Journal Entry.
Conditionals Lab Dan Maselko. Overview  Gain familiarity with working with conditionals  Become familiar with using the modulus operator  Understand.
© Copyright by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Tutorial 21 - “Cat and Mouse” Painter Application.
Subdue Graph Visualizer by Gayathri Sampath, M.S. (CSE) University of Texas at Arlington.
InDesign CS3 Lesson 3 Working with Frames. Using Frames Frames are containers in which you place graphics or text. Frames can also be used as graphic.
BoardMaker Ver 6 Creating Interactive Activities for the Classroom.
Reporting Aesthetics An ACEware Webinar 1:00-2:00 pm February 14 th, 2008.
Working with SharePoint Document Libraries. What are document libraries? Document libraries are collections of files that you can share with team members.
Introduction to VB.NET Tonga Institute of Higher Education.
Lab 5: drawing and output User Interface Lab: GUI Lab Sep. 25 th, 2013.
PowerPoint Basics (for Macs) 1. Before you start your project, you need: Completed project storyboard. Files with images, sound, or video already saved.
Lehigh University Introduction to Flash MX Sharmeen Mecklai.
Copyright 2007, Information Builders. Slide 1 WebFOCUS Maintain – Enhancing Objects with JavaScript Mark Derwin Information Builders Information Builders.
Turning Glowing Text into Animated Glowing Text Using Animation Shop.
Triangulation Introduction to Computer Graphics and Animation (Principle of Computer Graphics) Rattapoom Waranusast.
ASENT_IMPORT.PPT Importing Part Lists and Board Data Last revised 10/28/2009.
Visual Basic .NET BASICS
Exercise 1: Creating GIS data—points lines and polygons A very common method of creating vector data is to physically create these files through on-screen.
Putting Applets into Web Pages.  Two things are involved in the process of putting applets onto web pages ◦ The.class files of the applet ◦ The html.
Object-Oriented Analysis & Design Subversion. Contents  Configuration management  The repository  Versioning  Tags  Branches  Subversion 2.
CSC 361/661 Digital Media Spring 2010 Professor Burg.
Project Deployment IT [211 CAP] How to convert your project to a full application.
Animate picture to peek from bottom (1 of 3) 1. Right click on picture you want to animate. 2. Click on Custom Animation. 2 1 R.
Forms and Server Side Includes. What are Forms? Forms are used to get user input We’ve all used them before. For example, ever had to sign up for courses.
HTML Concepts and Techniques Fifth Edition Chapter 6 Using Frames in a Web Site.
Creating Art With Simple Shapes By carefully implementing simple shapes to an HTML canvas we can create useful graphics. With enough time, lines, ellipses.
An Example of Windows Forms Applications Windows-based application –Win Forms Control structures (selection and repetition) Graphics Read integers from.
TA SURVEY Have the TA write their name on the board Fill out the survey at: The TA should walk out 5 minutes.
Learning Unity. Getting Unity
Sketchup For 3D Design Part 2: 3D Text.
Introduction to Flash Animation CS 318. Topics Introduction to Flash and animation The Flash development environment Creating Flash animations  Layers.
Lesson #4 Magazine Cover Graphic ArtsHampton Middle School Mrs. Werger, Mr. Scott, & Mr. Berwick.
Return to Outline Copyright © 2011 by Maribeth H. Price 3-1 Labeling and annotation.
1 Getting Started with C++. 2 Objective You will be able to create, compile, and run a very simple C++ program on Windows, using Visual Studio 2008.
© Copyright by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Tutorial 21 - “Cat and Mouse” Painter Application.
Lesson 10 - Mail Merge and Reviewing Documents Advanced Microsoft Word.
Activities  For this lab we will be creating a “Video Games List" application.  It is a simple app that allows a user to view and edit a list of video.
What is it and how do you build one? Building a Proclib.
Making Folders (Revised 5/27/10) Adding/Editing Local Gallery Folders By Elizabeth Liang under the direction of Professor Susan Rodger Duke University.
Graphics Concepts CS 2302, Fall /17/20142 Drawing in Android.
How to Use Google Charts. Using Google Charts Google Charts is used to provide a way to visualize data on your website. You can choose to use simple line.
CSD 340 (Blum)1 Starting JavaScript Homage to the Homage to the Square.
Files Tutor: You will need ….
© 2011 Delmar, Cengage Learning Chapter 4 Working with Frames.
Lawrence Snyder University of Washington, Seattle © Lawrence Snyder 2004 Drawing pictures … It’s not art, it’s fun.
JAVA: An Introduction to Problem Solving & Programming, 6 th Ed. By Walter Savitch ISBN © 2012 Pearson Education, Inc., Upper Saddle River,
HTML Basics. HTML Coding HTML Hypertext markup language The code used to create web pages.
Open a new Flash File Action Script 2.0. Create a button like you did last lesson and name it Click to Play.
PPT2.01 CREATING AND MODIFYING TEXT AND GRAPHIC OBJECTS Dr. Ennis-Cole.
Software Design– Unit Testing SIMPLE PRIMER ON Junit Junit is a free simple library that is added to Eclipse to all automated unit tests. The first step,
Learning the Basics of ArcMap 3.3 Updated 4/27/2010 Using Arc/View pt. 1 1.
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.
Learning to use a ‘For Loop’ and a ‘Variable’. Learning Objective To use a ‘For’ loop to build shapes within your program Use a variable to detect input.
ENGINEERING 1D04 Tutorial 4. What are we doing today? Focus Functions Scope of Variables Returning Values Objects Graphics library Aliasing Events Mouse.
Arrays Chapter 7.
MS Paint A simple drawing tool that can be used to create simple or elaborate drawings. These drawings can be either black-and-white or color, and can.
Adding Assignments and Learning Units to Your TSS Course
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
Building Java Programs
CS 115 Lecture Graphics II – coordinate systems, Text, Entry, aliases
1. Open Visual Studio 2008.
Graphics Part I Taken from notes by Dr. Neil Moore
Learning the Basics of ArcMap 3.3 Updated 4/27/2010
Building Java Programs
Presentation transcript:

Graphics Lab: MyPaint Dan Maselko 1

MyPaint Description  For this assignment you will be implementing a very simple paint program.  You should be able to draw shapes with an arbitrary number of sides by clicking with the mouse.  You should allow the user to specify the fill color for the shape.  The drawing should exit when the user double clicks and they are not in the middle of drawing a shape.  Graphics Library Quick Reference Graphics Library Quick Reference 2

Step 0 – Getting Started 3  Make a lab8 directory in your 201/labs directory  Copy the graphics.py file from Mr. Lupoli’s directory into your lab8 directory cp /afs/umbc.edu/users/s/l/slupoli/pub/labCode201/graphics.py.  Use emacs to create a lab8.py  Important Note: You need to use a different version of python to run this lab: /usr/local/bin/python2.4 lab8.py

Drawing the Shape 4  Each Point that the user clicks is a point in the shape  Lines should be drawn between each point as the shape is being drawn  When you finish drawing a shape, you should double click on the last point that you want to draw. This should cause a Polygon to be drawn using the points that the user clicked  Keep a list of Points that the user clicks  We want to stop drawing Polygons when the user double clicks and they aren’t in the middle of drawing a shape

Drawing the Shape 5  Why do we need the Polygon?  The user should be able to type in the fill color of the shape using an Entry object  We can’t “fill” the space between Lines, but we can fill a Polygon  aint%20Lab.html aint%20Lab.html

Step 1 – Really Getting Started 6  Begin by opening a Graphics window  Get two separate mouse clicks from the user and append them to a list  Draw a line between the two points

Step 2 – (Really slow) Double Clicking 7  We need to have a function that checks if two points are equal so we know to end drawing. We can’t do this:  We actually need to compare the X and Y coordinates of each Point, not just the points themselves  Put this comparison into a function!  Using this function, you should be able to pass two Points to it, and the function should check if their X and Y values are equal  Why would we want to make this into a function? pt1 = Point(12, 34) pt2 = Point(12, 34) while pt1 == pt2: # Do stuff pt1 = Point(12, 34) pt2 = Point(12, 34) while pt1 == pt2: # Do stuff

Hint time!! 8  Using a list, what code would we use to get the last Pt added to the list  pointList[-1]  How about the one before THAT!!!  pointList[-2]

Step 3 – Drawing Until a Double Click 9  Modify your code so that you can continue to draw lines while you have not double clicked  What kind of control structure should we use?  You should check if the first two points in the list are equal  Make sure you start with an empty list when you start drawing each line

Step 4 – Drawing More Than Just Lines 10  We want to keep adding points to the list while the last two points that we clicked are not equal  What is already in our program that checks this condition?  We also want to always draw lines between the last two points that we clicked  Keep in mind that we want to do all of this inside of the control structure that we just made in the previous step

Step 5 – The Polygon 11  If the user is drawing a bunch of lines, and they double click, a Polygon should be drawn  To make this Polygon, you should use the list of points that you’ve been keeping track of as the user clicked the mouse

Step 6 – Adding Color 12  Add an Entry object to your graphics window when you open it for the first time, so that the user can type in the color they want to fill the Polygon with  Right before we draw the Polygon, you should get the text from the Entry object, and set the fill color of the Polygon to that color  Make sure to strip off any whitespace from the fill color! polygon.setFill(fillColor.strip())

Bonus Step – Outline Color 13  Add another Entry object so that the user can specify the outline color of the Polygon  The color should be applied to the outline color of the Polygon when we draw it, and it should be the color of each Line that we draw while we are clicking to draw our shape