#!/usr/bin/python # # hdraw # # Author : Jak Kirman # Attributions : # Date : 13 May 1995 # Last modification : 21 Dec 1996 # $Id$ # Drawing program for young children. # HTML version, 20 May 1995 # Moving the mouse draws lines. # Clicking the left mouse button changes the color randomly. # Clicking the middle mouse button changes the thickness of the lines # randomly. # Typing 'q' quits. # Typing 'p' prints the image in Postscript form. import Tkinter, sys, os, Pencil from Tkinter import Widget if os.environ.has_key ('REMOTE_HOST'): env = '-d %s:0.0' % sys.environ['REMOTE_HOST'] html = 1 else: html = 0 if html: print '''\ Content-type: text/html
Type p to get a Postscript version of the image.
Type q to quit the program.
'''
frame = Tkinter.Frame (None)
width, height = frame.winfo_screenwidth()-50, frame.winfo_screenheight()-50
canvas = Tkinter.Canvas (frame, width=width, height=height,
background="white")
pencil = Pencil.Pencil (canvas, html=html)
Widget.bind (canvas, "