sep 25
- see rot13
- talk about homework
- new stuff: chapter 5
chap 5
- objects
- graphics package from text
- graphics.py from text or from ppitcs code
- put it in the same directory you're workin in
- it's installed site-wide on cs
- but if your ssh'ing to cs, you'll need to be running X11 on your computer to see the graphics stuff (part of MacOS; part of cygwin for windows; default part of linux/unix)
# sample graphics commands
$ python
>>> from graphics import *
>>> dir() # show me what's defined here
>>> help(Line) # tell me about this thing
>>> win = GraphWin() # make one of these things (200 x 200)
>>> p1 = Point(50,60) # ditto
>>> p2 = Point(140,100) # and another
>>> p1.draw(win)
>>> p2.draw(win)
>>> line = Line(p1,p2) # make one of these things
>>> line.draw(win) # and let me see it
This module has lots of bells and whistles.
"As usual, the best way to learn new concepts
is to roll up your sleeves and try out some examples." - the text
- objects ...
- are data and methods combined
- class (Point) vs instance (p1)
- thing.clone()
- constructor
Section 5.8 : Graphics Module Reference