Saint Louis University |
Computer Science 1300
|
Computer Science Department |
Please make sure you adhere to the policies on academic integrity.
can = Canvas(100,100)Python reports an error with the last line saying
NameError: name 'Canvas' is not definedWhat did you do wrong? How do you fix it?
sq.setFillColor(Red)Give two different ways to fix this statement.
cir = Circle() cir.moveTo(50,50) cir.setRadius(15) cir.setFillColor('Blue') can.add(cir) sq = Square() sq.setSize(40) sq.moveTo(50,50) sq.setFillColor('Red') can.add(sq)The square appears, but not the circle. What’s wrong with the above program? How might you change the program so that both appear?
can = Canvas(200,150) rect = Rectangle() rect.setWidth(50) rect.setHeight(75) rect.moveTo(25,25) rect = Rectangle() rect.setWidth(100) rect.setHeight(25) can.add(rect) can.add(rect)Only one rectangle appears? Why? How would you get two different rectangles to show up? (There are several ways to fix this.)