[Edu-sig] graphics programming with Python

Sheila King sheila@thinkspot.net
Sat, 12 May 2001 11:00:38 -0700


Hi Danny, I'm trying to use your simple graphics module.

The problems that I wrote to you about earlier, were related to installing a new
version of IDLE that came with VPython and overwrote my default install that
came with Python2.0. I've got that fixed, now.

So, I've put your graphics module under Python20/Lib/ and when I try to run your
little script below, a Tkinter window comes up, but it is blank, and it stays
blank.

???

Help?

--
Sheila King
http://www.thinkspot.net/sheila/
http://www.k12groups.org/


On Wed, 9 May 2001 03:16:29 -0700 (PDT), Daniel Yoo <dyoo@hkn.eecs.berkeley.edu>
wrote about [Edu-sig] graphics programming with Python:

:Here's a preliminary version of a simplified interface to a Tkinter
:canvas.  It's simple enough so that the user just needs to type:
:
:###
:from graphics import *
:
:def drawBox(x1, y1, x2, y2):
:    """Draws a box where the upper left is (x1, y1), and the
:    lower right is (x2, y2)."""
:    positionPen(x1, y1)
:    drawLineTo(x2, y1)
:    drawLineTo(x2, y2)
:    drawLineTo(x1, y2)
:    drawLineTo(x1, y1)
:
:drawBox(-100, 100, 100, -100)
:###
:
:to get a box drawn.  By default, the Canvas is 400x400, and the user can
:send commands like:
:
:    drawLine
:    drawPoint
:    setRGBColor
:
:without having to worry about creating a canvas.  Also, it uses normal
:rectangular coordinates, so (0, 0) is at the center, (200, 200) is the
:upper right corner, and (-200, -200) is the bottom left.
:
:Please give suggestions on this; I just typed this up yesterday, so it
:surely has room for improvement and clarity.
:
:I hope this is useful!