Rewriting of the graphics library in 'Python for the Absolute Beginner' book.
Project description
README
----------------------------
Introduction:
-----------------
This graphics library was written to be exactly comptible with the chapters
in the book: 'Python for the Absolute Beginner'. The reformatted version of
livewires(http://tertial.livewires.org.uk/python/home) was incredibly simple
to use, powerful, and had many features. As the book became outdated copies of
the library-the reformated version-became harder and harder to find. Trying to
find a copy to teach some newcomers to python and failing, we decided
to write our own library, compatible, to the dot, with the book's tutorials.
Hopefully this will help a some people.
Since this is a reformatted version of livewires,we decided to call it
superwires. If you have a copy of the book, or any of its programs, you
only have change the line: 'from livewires import game' to
'from superwires import games' and it will work as intended. If you don't have
the book and just want a good graphics library for python, read the tutorial
ahead, or read the documentation at: https://pythonhosted.org/SuperWires/
Tutorial
---------------
Simple Program:
----------------
from superwires import games
games.init(screen_width=640, screen_height=480, fps=50)
#makes screen with width, height, and frames per second
games.screen.mainloop() # event loop
That made a black window!!!
Now add this line in the middle:
games.screen.background=load_image('filename.png')
That made a background!!!
Now this:
games.screen.add(Sprite(games.load_image('file.png'), x=320, y=240, dx=3, dy=3))#dx and dy stand for delta x and delta y
That made a moving sprite!!!!
Overriding Sprite:
-----------------------
First make a class:
class Bouncy_Ball(games.sprite):
def __init__(self):
super(self, Bouncy_Ball).__init__(games.load_image('ball.png'), x=320, y=240, dx=3, dy=3)#normal super init
def update(self): #this is empty by default but is called every frame
if self.left<=0 or self.right>=640:#right and left edges to check if on edge
self.dx*=-1#reverse x velocity
if self.top<=0 or self.bottom>=480:#top and bottom edges to check if on edge
self.dy*=-1#reverse y velocity
Now instead of adding a sprite do:
games.screen.add(Bouncy_Ball())
That made a bouncing ball!!!!!
----------------------------
Introduction:
-----------------
This graphics library was written to be exactly comptible with the chapters
in the book: 'Python for the Absolute Beginner'. The reformatted version of
livewires(http://tertial.livewires.org.uk/python/home) was incredibly simple
to use, powerful, and had many features. As the book became outdated copies of
the library-the reformated version-became harder and harder to find. Trying to
find a copy to teach some newcomers to python and failing, we decided
to write our own library, compatible, to the dot, with the book's tutorials.
Hopefully this will help a some people.
Since this is a reformatted version of livewires,we decided to call it
superwires. If you have a copy of the book, or any of its programs, you
only have change the line: 'from livewires import game' to
'from superwires import games' and it will work as intended. If you don't have
the book and just want a good graphics library for python, read the tutorial
ahead, or read the documentation at: https://pythonhosted.org/SuperWires/
Tutorial
---------------
Simple Program:
----------------
from superwires import games
games.init(screen_width=640, screen_height=480, fps=50)
#makes screen with width, height, and frames per second
games.screen.mainloop() # event loop
That made a black window!!!
Now add this line in the middle:
games.screen.background=load_image('filename.png')
That made a background!!!
Now this:
games.screen.add(Sprite(games.load_image('file.png'), x=320, y=240, dx=3, dy=3))#dx and dy stand for delta x and delta y
That made a moving sprite!!!!
Overriding Sprite:
-----------------------
First make a class:
class Bouncy_Ball(games.sprite):
def __init__(self):
super(self, Bouncy_Ball).__init__(games.load_image('ball.png'), x=320, y=240, dx=3, dy=3)#normal super init
def update(self): #this is empty by default but is called every frame
if self.left<=0 or self.right>=640:#right and left edges to check if on edge
self.dx*=-1#reverse x velocity
if self.top<=0 or self.bottom>=480:#top and bottom edges to check if on edge
self.dy*=-1#reverse y velocity
Now instead of adding a sprite do:
games.screen.add(Bouncy_Ball())
That made a bouncing ball!!!!!
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
SuperWires-0.9.2.zip
(13.3 kB
view hashes)
Built Distributions
SuperWires-0.9.2.win32.exe
(208.8 kB
view hashes)
SuperWires-0.9.2-py2.7.egg
(19.6 kB
view hashes)
Close
Hashes for SuperWires-0.9.2.linux-x86_64.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | ff720f23d8c2b8ad1965b620f6c9b72dd517c28244dbd1b101c778280cc50acf |
|
MD5 | 3da18c26e382995f81f54d9616f98026 |
|
BLAKE2b-256 | 6bc5d043f3a6e83b6cb79bcddb1a3d736e872e8439797eb9ba83f4321df222f2 |