https://github.com/i80and/gamekit
Miniature graphics library for Python with no dependencies
https://github.com/i80and/gamekit
Last synced: 8 months ago
JSON representation
Miniature graphics library for Python with no dependencies
- Host: GitHub
- URL: https://github.com/i80and/gamekit
- Owner: i80and
- License: mit
- Created: 2014-06-29T22:56:42.000Z (almost 12 years ago)
- Default Branch: master
- Last Pushed: 2014-08-22T00:52:20.000Z (almost 12 years ago)
- Last Synced: 2025-03-28T20:12:42.836Z (over 1 year ago)
- Language: Python
- Size: 164 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
GameKit
=======
GameKit is a miniature graphics library for Python with no dependencies, outside
of an intact (including tkinter) Python installation. This may be useful for
getting started with a project quickly with no fuss, or if you want to deploy
onto systems without having to ship dependencies.
Mostly, it's just a test to see how capable Tkinter is out-of-the-box. The
answer is: not very, but you can fudge it if you're OK with dog-slow performance,
no alpha channel (bitmask transparency is OK), and just using GIF files.
Don't expect tests or real documentation. The code is very small, at least,
so there isn't much going on.
Prerequisites
=============
Technically none other than Python and a working graphics system. On Debian and
Ubuntu, you may have to execute
$ sudo apt-get install python3-tk
Documentation
=============
There are a few important classes in GameKit:
* Point
* Game
* Thing
* Text
* MovingThing
* Camera
Game
----
`Game` is the basic entry point for your code. It has 4 methods that should be
defined in your subclass:
* `init()` is called after the window is opened and Tk is ready.
This may be useful for loading sprites and creating entities.
* `update()` is called at each tick of the mainloop (around every
16 ms) before the screen is cleared and the redraw phase begins.
* `draw(camera)` is called after the screen is cleared, and is responsible for
repopulating the canvas.
* `input(event)` is called whenever an input event occurs.
Examples
========
See `demo1.py` for a demonstration of how to use GameKit.