[Tutor] Classes

Alan Gauld alan.gauld at btinternet.com
Sat Jul 12 13:51:52 CEST 2008

"Alan Gauld" <alan.gauld at btinternet.com> wrote 

> class Square:
>     def __init__(self,p1,p2,p3,p4):
>          self.points = [p1,p2,p3,p4]
>     def draw(self):
>          myTookKitDrawSquare(p1.x,p1.y, p1.col,
>                                            p2.x,p2.y, p2.col,
>                                            p3.x,p3.y, p3.col,
>                                            p4.x,p4.y, p4.col)

Oops! The p1.x etc should of course have been
self.points[0].x etc draw cannot use the point
parameters from init! 

Alan G.

More information about the Tutor mailing list