CPSC 217 T03 Week II Part #1: SimpleGraphics.py Hubert (Sathaporn) Hu.

Slides:



Advertisements
Similar presentations
Interaction Design: Visio
Advertisements

Graphics Shapes. Setup for using graphics You have to import the graphics library You can use either “import graphics” or “from graphics import *” or.
Laboratory Study II October, Java Programming Assignment  Write a program to calculate and output the distance traveled by a car on a tank of.
CSC1401 Drawing in Java - 2. Reminder from last class How do you save your modified picture? String filename = …; Picture stevePicture = new Picture(filename);
Intro to Microsoft PowerPoint 2010 Public Computer Center, Moore Memorial Library, Greene, NY.
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.
Higher-level PHP constructs for manipulating image files.
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.
Graphics ~ Tools To Edit Clip Art MsBrewer Fall 2012.
Java Software Solutions Lewis and Loftus Chapter 7 1 Copyright 1997 by John Lewis and William Loftus. All rights reserved. Graphics -- Introduction The.
1 Graphical User Components (II) Outline JTextArea Creating a Customized Subclass of JPanel JPanel Subclass that Handles Its Own Events Windows: Additional.
Tutorial 2 Drawing Text, Adding Shapes, and Creating Symbols.
1 Essential HTML coding By Fadi Safieddine (Week 2)
Instructor: Chris Trenkov Hands-on Course Python for Absolute Beginners (Spring 2015) Class #002 (January 17, 2015)
Getting Started with Canvas IDIA Spring 2013 Bridget M. Blodgett.
Addison Wesley is an imprint of © 2010 Pearson Addison-Wesley. All rights reserved. Chapter 5 Working with Images Starting Out with Games & Graphics in.
Interaction Design Interaction Design - Joan Cahill - Visio Interaction Design: Visio.
CPSC 217 T03 Week I Part #1: Unix and HELLO WORLD Hubert (Sathaporn) Hu.
Creating HUD Rings. Step 1 Open a new document in Illustrator. You can set it to the size you prefer to work in. In my case I have it set at 500px by.
Graphic Basics in C ATS 315. The Graphics Window Will look something like this.
How to Design a Page, Part 2 HOWE/ANDERSON. Step 1: Login   Job No  User ID/ Password.
CPSC 217 T03 Week I Part #2: Python Tricks for Exercise #1 Hubert (Sathaporn) Hu.
2-D Shapes, Color, and simple animation. 7 Basic Shapes Ellipse :: ellipse() Arc :: arc() Line :: line() Point :: point() Rectangle :: rect() Triangle.
© Anselm Spoerri Lecture 7 Meaning –Guiding Principles for Term Project Mechanics –Interactivity Recap –Simple and Disjointed Rollovers and Image Map –Navigation.
CSC 1010 Programming for All Lecture 7 Input, Output & Graphics.
CPSC 217 T03 Week III Part #1: Base Conversion Hubert (Sathaporn) Hu.
Creating visual interfaces in python
Graphics and Java2D Chapter Java Coordinate System Origin is in _____________ corner –Behind title bar of window X values increase to the ________.
CPSC 217 T03 Week VI Part #2: Midterm Review Session Hubert (Sathaporn) Hu.
CPSC 217 T03 Week VI Part #1: A2 Post-Mortem and Functions Hubert (Sathaporn) Hu.
CPSC 217 T03 Week V Part #1: Iteration Hubert (Sathaporn) Hu.
This document will help you create accessibility documents including fonts, colours, and hyperlinks.
Paint Tutorial Created February 2006 Start Paint: Start>Programs>Accessories>Paint.
+ This step by step tutorial demonstrates drawing a keyboard illustration using rectangles, grids, move and transform effects.
VBQU149 Create texts of some complexity. Columns Making columns in Microsoft Word Open word and blank page type =rand() Go to page layout, then columns.
CS 115 Lecture 7 Graphics – coordinate systems, Text, Entry, aliases Taken from notes by Dr. Neil Moore.
Graphics Lab: MyPaint Dan Maselko 1. MyPaint Description  For this assignment you will be implementing a very simple paint program.  You should be able.
CS 115 Lecture 6 Graphics Taken from notes by Dr. Neil Moore.
(PART II) Graphics and Multimedia. Font Control Font s  After a Font is created, its properties cannot be modified  Programmers must create a new Font.
(PART II) Graphics and Multimedia 11/02/1437 Lect6 (Part 2)
Graphics Taken from notes by Dr. Neil Moore & Dr. Debby Keen
GUI in Python Ismail Abumuhfouz.
Graphical Output Graphical Text.
Lesson One: The Beginning Chapter 1: Pixels Learning Processing Daniel Shiffman Presentation by Donald W. Smith Graphics from
Graphics Part I Taken from notes by Dr. Neil Moore
Paddle Ball! We will begin creating, in steps, a video game similar to ‘brick breaker’ or ‘pong’, were we can move paddles to hit a bouncing ball. I hope.
Graphics Part I Taken from notes by Dr. Neil Moore
Chapter 14 JavaFX Basics Dr. Clincy - Lecture.
Physics Careers February1st, 2017
CS 115 Lecture Graphics II – coordinate systems, Text, Entry, aliases
به نام مهربانترین In the name of the most compassionate
Project title Scheduled dates Team members JAN FEB MAR APR MAY JUN
ISC440: Web Programming II Ch14: HTML5 Canvas
بسم الله الرحمن الرحیم مركز بهمن استاندارد- مديريت ارزيابي و مانيتورينگ كيفي.
First line of text goes here
Graphics -- Introduction
CS 115 Lecture Graphics II – coordinate systems, Text, Entry, aliases
Les Verbes ER LCHS NOW SHOWING Marquee with 3-D perspective rotation
Sample heading First line of text Second line of text
SES First Grade Field Trip
سرطان پستان دکتر مریم طباطباییان پاییز ۱۳۹۱
Graphics Part I Taken from notes by Dr. Neil Moore
Pictures in 3-D flip book (Intermediate)
Graphics and Multimedia
ONE NIGHT ONLY! CJMS Talent Show Friday, December 11
spotLIGHT TEXT Ppt宝藏 提供下载 (Intermediate)
LPD Church of the Week We praise God for the smooth transition to two services and for the new faces we have seen as a result of increasing our capacity.
قاعده لا ضرر، تنها در شبهات حکمیه جاری است
THE VOYAGE.
TITLE BYOT Half Circle (Advanced)
Presentation transcript:

CPSC 217 T03 Week II Part #1: SimpleGraphics.py Hubert (Sathaporn) Hu

Apology about Last Week! Exercise #1 actually CANNOT be done in a single done. Sorry about that.  This is only applicable to students in T03.

News I have swapped my shift with another TA.  So if you are in T03, your Wednesday TA will be different one.  If you are in T04, I am your TA today. If you’re in T03, Exercise #1 has been marked! I do not know anything if you are in T04

Today’s Tutorial More Terminal tips SimpleGraphics.py  The coordinate system  Setting background color  Drawing line and shapes  Texting  Setting outline  Colouring stuffs

TIPS! 1.You don’t need to cd all the time to reach a desired file. If you already know the path of the file, just enter it as an argument. python3 Documents\prog.py – relative path python C:\prog.py – absolute path 2.If you want to reuse the previous command in terminal, press up arrow key. 3.Want to experiment something in Python? Simply call python3 without any file. You will be greeted with an interactive shell.  Unfortunately, the interactive shell doesn’t work with SimpleGraphics.py though…

SimpleGraphics.py This is the library that you will need to use to complete Exercise #2 and Assignment #1. To use the library, download it from the class website and put it in the same directory with your program. Then call: from SimpleGraphics import *

SimpleGraphics.py To draw something with SimpleGraphics, you need to know the coordinate. The library uses the coordinate system similar to 2D Cartesian plane. The exception is that unlike 2D Cartesian plane, the Y-axis is inverted. Please also beware that you only have 800 x 600 pixels to work with. (0,0) x y

SimpleGraphics.py So when you draw an object at coordinate of (100, 50), it means the object is 100 pixels right to the origin and is 50 pixels down from the origin. (0,0)

SimpleGraphics.py After you get used to the twisted and inverted world of SimpleGraphics.py, you now want to get started. White background is boring, we want to change it! Use these commands: background(str_color_name) background(red, green, blue)

SimpleGraphics.py To draw lines, use these commands: line(x1, y1, x2, y2) – Make a line. If you add more points, you can also make lines with angles.  line(x1, y1, x2, y2, x3, y3, …) If you want to draw an arc, please consult tutorial.pdf.

SimpleGraphics.py To draw other shapes, use other commands: rect(x, y, width, height) – Make a rectangle ellipse(x, y, width, height) – Make an ellipse/circle polygon(x1, y1, x2, y2, …) – Make a polygon There are other shapes in tutorial.pdf

SimpleGraphics.py To draw a text, set a font before setting the text. To set the font:  setFont(font_name, size, style) font_name: a string that represents the name of the font. For example, “Arial”. size: a string that contains the size number. For example, “18” style: a string that indicates how the text is rendered. Options include “bold”, “italic”, “bold italic.”  Note that the second and the third arguments are optional.

SimpleGraphics.py To set the text:  text(x, y, text) x: a number that represents x-coordinate y: a number that represents y-coordinate text: the text to be drawn itself

SimpleGraphics.py If you find the colours boring, then you can change it with these functions:  Changing the outline (or border) colour. setOutline(str_color_name) setOutline(red, green, blue)  Filling a shape with a colour. setFill(str_color_name) setFill(red, green, blue)

SimpleGraphics.py Colouring must be done the object is drawn. Also, when you call a colouring function, all the objects that are created after the function call will have the same colouring. # These objects will be purple! setOutline(“purple”) setFill(“purple”) line(0, 0, 100, 100) ellipse(60, 100, 40, 40) polygon(50, 50, 100, 100, 200, 200, 50, 50)

One Last Thing The remainder of the class is to be used for completing Assignment #1 and Exercise #2. However, before that, you should also think about the first part of Assignment #1. It asks you to receive the user’s input and then uses the input to set an object’s position. If you don’t know how to do this, please don’t hesitate to ask me.