Presentation is loading. Please wait.

Presentation is loading. Please wait.

LING 408/508: Computational Techniques for Linguists

Similar presentations


Presentation on theme: "LING 408/508: Computational Techniques for Linguists"— Presentation transcript:

1 LING 408/508: Computational Techniques for Linguists
Lecture 24

2 Administrivia Reminder: project proposals!

3 Today's Topic Chapter 5 from the pythonbook: Objects and Graphics

4 graphics.py installation

5 Graphics Graphics is not usually part of a programming language
However, html5 has canvas and svg built-in Traditionally: Graphics  Libraries and Toolkits Example: Tk (designed by John Ousterhout as an extension to Tcl) Tcl (Tool Command Language, also designed by John Ousterhout) Tk was originally built on top of the (portable) X11 client-server window system for Unix but has also been ported to native, e.g. OSX, platform graphics

6 Graphics Zelle uses Tk: Tkinter: import graphics.py
Tkinter is Python's de-facto standard GUI (Graphical User Interface) package. It is a thin object-oriented layer on top of Tcl/Tk.

7 Tk Examples:

8 Tcl A simple programming language:

9 Tcl/Tk on Mac OS X

10 Tcl/Tk on Ubuntu

11 Tcl/Tk on Ubuntu

12 Tcl/Tk Examples Command line: wish interpreter for tcl/tk Concepts:
canvas place to draw coordinate system (0,0) topleft pack where to put canvas

13 graphics.py Point: Implemented as a rectangle:

14 graphics.py page 129

15 graphics.py Call method draw() once only

16 graphics.py Rectangle: .draw() Oval: .draw() Circle: .getRadius()
Object inheritance (see graphics.py code): _Bbox: move Rectangle: .draw() Oval: .draw() Circle: .getRadius() Line: .draw(), .setArrow()

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


Download ppt "LING 408/508: Computational Techniques for Linguists"

Similar presentations


Ads by Google