{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

ecs10graphics - LiveWires beginners support library This...

Info icon This preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
############################################################################### # # # LiveWires beginners' support library # # This library provides a simple graphics API to allow procedural # programming using (in this instance) Tk to provide an output # window. It is intended, however, to be graphics-subsystem # independent. # ############################################################################### # # Including modifications for ECS 10, by Nina Amenta, 10/2006 # # Additional modification for ECS 10, by Nina Amenta, 10/2007 # # Revised animation loop, which seems to play well with IDLE on # Windows XP, Windows Vista, and Mac OS X, based on an example # due to Fredrik Lundh, which I found on effbot.org ("A Simple # Animation Example") # ############################################################################### # Copyright Richard Crook and Gareth McCaughan. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # Redistributions of source code must retain the above copyright notice, # this list of conditions and the following disclaimer. # # Redistributions in binary form must reproduce the above copyright notice, # this list of conditions and the following disclaimer in the documentation # and/or other materials provided with the distribution. # # Neither name of Scripture Union nor LiveWires nor the names of its # contributors may be used to endorse or promote products derived from # this software without specific prior written permission. # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS # ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SCRIPTURE UNION # OR THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ############################################################################### # ############################################################################### ### External dependencies ##################################################### ############################################################################### # import sys import math import random
Image of page 1

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
import string import time import types import Tkinter as tk i ############################################################################### ### Module statics ############################################################ ############################################################################### # _Windows = sys.platform == 'win32' # True if on Win95/98/NT # and Vista too! _root_window = None # The root window for graphics output _canvas = None # The canvas which holds graphics _canvas_xs = None # Size of canvas object _canvas_ys = None _canvas_x = None # Current position on canvas _canvas_y = None _canvas_col = None # Current Color (set to black below) _canvas_tsize = 12 _canvas_tserifs = 0 _ if _Windows: _canvas_tfonts = ['times new roman', 'lucida console'] else: _canvas_tfonts = ['times','lucidasans-24'] pass # XXX need defaults here _mouse_enabled = 0 # mouse_begin called _mouse_x = None # Initial position assumed outside _mouse_y = None # the window _ _returning = 0 # Return objects when created? _ ############################################################################### ### Exception classes ######################################################### ############################################################################### # class LWException(Exception): pass class ExAlreadyStarted(LWException): pass class ExBadParameters(LWException): pass class ExUnimplemented(LWException): pass c ############################################################################### ### Class for canvas object encapsulation ##################################### ############################################################################### # class Movable: c def __init__(self, id, coord_list): self.id = id self.coord_list = coord_list
Image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern