Summit Middle School classes for Andrew Busch
Andrew Busch - Summit
  • Home
  • Algebra 1
    • Alg 1B - Last Week
    • Alg1B 14 HW - Intro to Functions
    • Alg 1B 11 - Rational Expressions
    • Alg 1B 12 - Radical Expressions
    • Alg 1B 10 v2.0 - Quadratic Functions >
      • 10b Graphing with Pennies - Desmos Tutorial
      • 10i Snowboard Quadratic - Alg1B
      • 10 Quadratics Project
    • Alg 1B 10 Book - Factoring Quadratics
    • Alg 1B 9 - Exponential Functions
    • Alg 1B 8.5 - Representing Data
    • Alg 1B 13 - Inequalities
    • Alg 1B 8 - Best Fit Lines and Linear Regression
    • Alg 1B 7 - Linearity
  • Geometry
    • Geom Last Week
    • Geom 12 - Probability
    • Geom 11 - Circumference, Area, Volume
    • Geom 10-Circles
    • Geom 9 - Right Triangles and Trigonometry
    • Geom 8 - Similarity
    • Geom 7 - Quadrilaterals and Other Polygons
    • Geom 6 - Relationships Within Triangles
    • Geom 5 - Congruent Trianlges
    • Geom 4 - Transformations
    • Geometry 3.5 - Constructions
    • Geom 3 - Parallel and Perpendicular Lines
    • Geom 2 - Reasoning and Proofs
    • Geom 1 - Basics of Geometry
  • Programming
    • Directions for Sharing Programs with Me
    • Hour of Code
    • Intro to Python >
      • Installing and Using Portable Python
      • Introduction to Programming
      • Interactive Storyteller
      • Sophisticated Calculator
      • Getting Started with Games
      • Word Length Frequency
      • Substitution Cipher
      • Simple Game of Paddleball
      • Animating Many Objects
      • Accelerator
      • Applying Trigonometry
      • GIFs
      • Programmatic Art
      • Battleship
      • Pong
      • CodeCademy.com Suggested Work
      • Python Resources
    • Advanced Python >
      • Python Installation
      • Review of Intro to Programming
      • Objects and Classes >
        • More on Classes: Functions, Methods, Inheritance
        • Quadrilaterals
      • tkinter >
        • Paddle Ball
        • Light Bike
        • Frogger
        • Snake Game
        • Breakout
      • Reading and Writing Files
      • Directories and Importing Modules
      • Raspberry Pi
      • API's
      • Python Puzzles
  • Clubs
  • Graphing Calculator
  • PARCC Practice

G.I.F.s

The resources on this page were originally created by Dr. Aaron Bradley of Summit Middle School. I've done some reformatting to add clarity but that is about it. Enjoy!
GIFs

If you've been wanting to make your graphics-based games look nicer, here's one way. The Graphic Interchange Format (or GIF) is a way to compress digital images. The sgfx module provides a function to import image files saved as GIFs. 

To follow this tutorial, download the GIF files (below), and save them in your programming directory (i.e. your MyPrograms folder).
background.gif
File Size: 44 kb
File Type: gif
Download File

butterfly.gif
File Size: 1 kb
File Type: gif
Download File

The following code should look mostly familiar from an early graphics lesson.  It loads the two images and adds keyboard-based controls to the second one.  The first image was made to have size 500x500 so that it serves as a fancy background.  Both images are loaded to appear with their centers at (250, 250), but the second one moves.


from sgfx import *

w = Window()

w.gif(250, 250, 'background.gif')
bfly = w.gif(250, 250, 'butterfly.gif')

def left():
    w.move(bfly, -10, 0)
def right():
    w.move(bfly, 10, 0)
def up():
    w.move(bfly, 0, 10)
def down():
    w.move(bfly, 0, -10)
w.on('4', left)
w.on('6', right)
w.on('8', up)
w.on('2', down)

w.run()


With a better image editor than MS Paint, one can make the background color of the foreground object (the butterfly in this case) transparent so that the surrounding white box disappears.  But this tutorial at least gets you started on making prettier programs.

Powered by Create your own unique website with customizable templates.