Contents
- graphics_test.py
- rectangle.py
- tictactoe.py
graphics_test.py 1/3
[top][prev][next]
# Graphics Test Script
# Sara Sprenkle
from graphics import *
win = GraphWin("My Circle", 100, 100)
point = Point(50,50)
c = Circle(point, 10)
c.draw(win)
win.getMouse()
rectangle.py 2/3
[top][prev][next]
# Practicing using the graphics API
# by CSCI111
from graphics import *
win=GraphWin("Rectangle", 250, 250)
upper_left_pt = Point(0,50)
lower_right_pt = Point(100, 250)
rect = Rectangle(upper_left_pt, lower_right_pt)
rect.setFill("red")
rect.draw(win)
win.getMouse()
rect.move(10,0)
upper_left = rect.getP1()
lower_right = rect.getP2()
print upper_left.getX(), upper_left.getY()
print lower_right.getX(), lower_right.getY()
win.getMouse()
tictactoe.py 3/3
[top][prev][next]
#Create full-size tic-tac-toe board
# By CSCI111
from graphics import *
win = GraphWin("Tic-Tac-Toe", 300, 300)
vertLine1 = Line(Point(100,0), Point(100, 300))
vertLine2 = Line(Point(200,0), Point(200, 300))
vertLine1.draw(win)
vertLine2.draw(win)
horizLine1 = Line(Point(0,100), Point(300,100))
horizLine2 = Line(Point(0,200), Point(300,200))
horizLine1.draw(win)
horizLine2.draw(win)
win.getMouse()
Generated by GNU enscript 1.6.4.