burntresistor
May 27th, 2009, 11:41 PM
The book im using problem it has given me is create a program that uses squares instead of circles on the one it gives me,be able to draw additional squares on click im guessing it means cloning and not moving
have a message saying quit in a button. Im using rectangle because square wasnt in the command list in this chapter.
from graphics import *
def main():
win=GraphWin()
shape= Rectangle(Point(50,50), 20)
shape.setOutline("blue")
shape.setFill("blue")
shape2 = shape.clone()
shape.draw(win)
for i in range(10) :
p= win.getMouse()
c = shape2.getCenter()
dx = p.getX()-c.getX()
dy=p.getY() - c.getY()
shape.move(dx,dy)
#enter in quit box
button.setText("quit")
win.getMouse()
win.close()
main()
im getting this attribute error and im not sure what I need to fix:
AttributeError: 'int' object has no attribute 'clone'
have a message saying quit in a button. Im using rectangle because square wasnt in the command list in this chapter.
from graphics import *
def main():
win=GraphWin()
shape= Rectangle(Point(50,50), 20)
shape.setOutline("blue")
shape.setFill("blue")
shape2 = shape.clone()
shape.draw(win)
for i in range(10) :
p= win.getMouse()
c = shape2.getCenter()
dx = p.getX()-c.getX()
dy=p.getY() - c.getY()
shape.move(dx,dy)
#enter in quit box
button.setText("quit")
win.getMouse()
win.close()
main()
im getting this attribute error and im not sure what I need to fix:
AttributeError: 'int' object has no attribute 'clone'