Contents

  1. assigningConstants.py
  2. graphics_test.py
  3. rectangle.py

assigningConstants.py 1/3

[
top][prev][next]
# In response to a question in class: 
# What happens if we try to assign a value to a math data value?

import math

print(math.e)

math.e = 1

print(math.e)

graphics_test.py 2/3

[
top][prev][next]
# Graphics Test Script
# by Sara Sprenkle

from graphics import *

win = GraphWin("My Circle", 100, 100)
point = Point(50,50)
c = Circle(point, 10)
c.draw(win)

# demonstrate what happens, outside of IDLE, if the line below is commented out.
win.getMouse()

rectangle.py 3/3

[
top][prev][next]
# Draw a rectangle using the graphics API
# by CSCI111

from graphics import *

window = GraphWin("My Rectangle", 500, 500)

upper_left_point = Point(0, 0)
lower_right_point = Point(200, 300)

rectangle = Rectangle( upper_left_point, lower_right_point)

rectangle.draw(window)

rectangle.move(10,0)

new_upper_left_point = rectangle.getP1()

print(new_upper_left_point.getX(), new_upper_left_point.getY())

window.getMouse()

Generated by GNU Enscript 1.6.6.