Differences between revisions 3 and 4
Revision 3 as of 2003-10-09 18:58:19
Size: 2986
Editor: 208
Comment: Regularize according to http://www.python.org/doc/essays/styleguide.html
Revision 4 as of 2003-10-09 19:02:27
Size: 3182
Editor: 208
Comment: Add a repr for Rect.
Deletions are marked like this. Additions are marked like this.
Line 75: Line 75:

}}}
 
    def __repr__(self):
        return "%s(%r, %r)" % (self.__class__.__name__,
                               Point(self.left, self.top),
                               Point(self.right, self.bottom))

Points & Rectangles

A pair of classes to provide points and rectangles.

Surprisingly, I haven't been able to find a single Python module providing such primitive support.

WxPython supports wxPoint and wxRect, but it lacks many basic functions (such as, say, adding two points together to produce a third point..!)

This code is lacking a zillion essential features (such as "Length"). I only put in the ones I needed immediately. Please add, refactor, optimize, rename stuff to be more standard, etc., as you see fit..!

If there's an actual, accessible, easy-to-include Python module, not tied to a graphics library, that does this stuff already, please write about it here! No sense in reinventing the wheel. I've looked, but haven't found one. Hence this.

PointsAndRectangles (last edited 2008-11-15 13:59:40 by localhost)

Unable to edit the page? See the FrontPage for instructions.