LING 408/508: Programming for Linguists Lecture 23 November 25 th.

Slides:



Advertisements
Similar presentations
What Was I Thinking??. Key Terms 1. Control 1. Control 2. Design Mode 2. Design Mode 3. Event 3. Event 4. Form 4. Form 5. Interface 5. Interface 6. Properties.
Advertisements

Lecture 3 A First Graphic Program. Features of a simple graphic program.
Graphics Shapes. Setup for using graphics You have to import the graphics library You can use either “import graphics” or “from graphics import *” or.
Noadswood Science,  To know how to use Python to produce windows and colours along with specified co-ordinates Sunday, April 12, 2015.
1 Programming for Engineers in Python Autumn Lecture 5: Object Oriented Programming.
Chapter Day 5. © 2007 Pearson Addison-Wesley. All rights reserved2-2 Agenda Day 5 Questions from last Class?? Problem set 1 Posted  Introduction on developing.
1 Python Programming: An Introduction to Computer Science Chapter 3 Objects and Graphics.
Chapter 4 Objects and Graphics
Python: Graphics
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.
David Streader Computer Science Victoria University of Wellington Copyright: David Streader, Victoria University of Wellington GUI and the UI API COMP.
Java Programming, 3e Concepts and Techniques Chapter 3 Section 65 – Manipulating Data Using Methods – Java Applet.
David Streader Computer Science Victoria University of Wellington Copyright: David Streader, Victoria University of Wellington While loops and the UI API.
Geometers Sketch pad. Step 1: Open Sketch pad Use this to select items Use this to draw a point Use this to draw a circle Use this to draw a line Use.
Creating Buttons – Lesson 51 Creating Buttons Lesson 5.
PYTHON GUI PROGRAMMING
1 Graphics CSCI 343, Fall 2015 Lecture 2 Introduction to HTML, JavaScript and WebGL.
Tutorial 2 Drawing Shapes, Adding Text, and Creating Symbols.
1 Computer Science of Graphics and Games MONT 105S, Spring 2009 Session 20 Graphical User Interface (GUI)
By. Circle Draw a circle in the box Tell about its attributes: sides, angles, whether or not it’s a polygon. Add any additional information you know about.
Tkinter Canvas.
© Copyright 2012 by Pearson Education, Inc. All Rights Reserved. Chapter 9 GUI Programming Using Tkinter 1.
Some Graphics CS303E: Elements of Computers and Programming.
Graphical User Interface You will be used to using programs that have a graphical user interface (GUI). So far you have been writing programs that have.
With Jeff Gray and Ira Baxter Robert Tairas Visualization of Clone Detection Results Eclipse Technology Exchange Workshop OOPSLA 2006 Portland, Oregon.
Python Programming, 1/e1 Programming Thinking and Method (5a) Zhao Hai 赵海 Department of Computer Science and Engineering Shanghai Jiao Tong University.
Xiaojuan Cai Computational Thinking 1 Lecture 5 Objects and Graphics Xiaojuan Cai (蔡小娟) Fall, 2015.
Creating visual interfaces in python
Xiaojuan Cai Computational Thinking 1 Lecture 6 Defining Functions Xiaojuan Cai (蔡小娟) Fall, 2015.
Week 8 - Friday.  What did we talk about last time?  Static methods.
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.
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.
1 CSC103: Introduction to Computer and Programming Lecture No 16.
LING 408/508: Programming for Linguists Lecture 19 November 9 th.
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.
5. COMPUTING WITH GRAPHICS OBJECTS Dennis Y. W. Liu and Rocky K. C. Chang October 8, 2015 (Adapted from John Zelle’s slides)
Please open JCreator and follow these steps: 1)Configure  Options 2)JDK Tools 3)Choose Run Applet from drop-down 4)Click Default, then Edit 5)Click the.
CS 115 Lecture 7 Graphics – coordinate systems, Text, Entry, aliases Taken from notes by Dr. Neil Moore.
Session 7 More Implications of Inheritance & Chapter 5: Ball World Example.
Graphics Lab: MyPaint Dan Maselko 1. MyPaint Description  For this assignment you will be implementing a very simple paint program.  You should be able.
Vahé Karamian Python Programming CS-110 CHAPTER 4 Objects and Graphics.
CS 115 Lecture 6 Graphics Taken from notes by Dr. Neil Moore.
Graphics Programming. Graphics Functions We can think of the graphics system as a black box whose inputs are function calls from an application program;
Python Programming, 2/e1 Python Programming: An Introduction to Computer Science Chapter 4 Objects and Graphics Killer cars.
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.
Python Programming: An Introduction to Computer Science
Python Programming: An Introduction to Computer Science
Python Programming: An Introduction to Computer Science
CMPT 120 Topic: Functions – Part 4
Python: Simple Graphics and Event-driven Programming
Object orientation concepts
Graphics Part I Taken from notes by Dr. Neil Moore
Graphics Part I Taken from notes by Dr. Neil Moore
LING 408/508: Computational Techniques for Linguists
CS 115 Lecture Graphics II – coordinate systems, Text, Entry, aliases
CS 115 Lecture Graphics II – coordinate systems, Text, Entry, aliases
CSc 110, Spring 2018 Lecture 9: Parameters, Graphics and Random
Passing Parameters by value
Graphics Part I Taken from notes by Dr. Neil Moore
Shapes.
Simple Graphics Package
Topics Graphical User Interfaces Using the tkinter Module
LING 408/508: Computational Techniques for Linguists
Building Java Programs
Methods/Functions.
Presentation transcript:

LING 408/508: Programming for Linguists Lecture 23 November 25 th

Last Time Library graphics.py – built on top of Tkinter (Python interface to Tk) – built on top of Tk (graphics library) – built on top of X11 (graphics library) on Ubuntu

graphics.py

Object inheritance (see graphics.py code): GraphicsObject – Point: draw, move, clone – Text: clone, move, draw, setText, getText, setFace – Polygon: clone, getPoints, move, draw – _Bbox: move Rectangle: draw Oval: clone, draw – Circle: clone, getRadius Line: clone, draw, setArrow

Directly in wish tcl/tk Stylistic variation… graphics.py : use primitive object Point tk : uses plain x,y coordinates

Interactive Graphics textbook 5.7: –p = win.getMouse() returns a Point

Interactive Graphics

textbook 5.7: –input = Entry(center,width) creates a user- editable text box

Interactive Graphics

graphics.py API

Color: Color names: – see

graphics.py API

Section Happy birthday example nested function calls: Note: parameters are passed by value (copying) -not by reference (pointer) -(some other programming languages allow both options)

Section 6.5 To send a value back, use – return Multiple values can be returned: Note: None is returned when there is no return statement

triangle2.py Calculates the perimeter of a triangle you draw.

triangle2.py Note: parameters are passed by value (copying) -mutable objects (Point)

triangle2.py