Putting Things Together: A Drawing Program

Although not as ubiquitous as the famous "Hello World", the sample application explained in the following sections is quite common. We want it to draw ovals, rectangles, circles, and so forth. I've opted for simplicity rather than perfection in my design. Later I'll point out what's wrong with it.

We'll incorporate ideas from many chapters in our program, which we'll develop in two modules and three phases. The first phase is a simple application that draws ovals and rectangles. The second phase will add circles, squares, rounded rectangles, and text. (I know text isn't a shape, but I don't like the correct terminology, “glyph.”) The third phase will correct a serious design flaw introduced in the first ...

Get Python Programming with the Java™ Class Libraries: A Tutorial for Building Web and Enterprise Applications with Jython now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.