Inspired by MIT Scratch and PygameZero, answers the question "what should I try after Scratch?"
Take a look at TKGameLib in action in this short video: https://youtu.be/J0MHYo8oftU
PygameZero is really cool, but it requires extra libraries to be installed so isn't an option in some organisations such as schools. TKGameLib works on the default Python, it uses TKinter for graphics, sprites etc, and is designed to encourage exploration of everything.
Project aims:
- Make it easy to create visual or audio effects
- Give immediate results (like Scratch does), type some commands, press run, see results
- Run easily on the Raspberry Pi
- Run easily on Windows PCs in schools, to support my STEM Ambassador work
- Provide depth with plenty to explore.
- Python 3
- A working tkinter library
You can use git
or download a zip file of the code:
git clone https://github.com/ericclack/tkgamelib.git
Start up IDLE3 and create a new file, save it to the directory my_work
, then add the following code...
from packages import *
create_canvas()
sprite = ImageSprite('my_images/face.gif')
sprite.pen_down()
def move_sprite(event):
sprite.move(10,10)
when_key_pressed('<space>', move_sprite)
mainloop()
Check out the examples directory. You should be able to run the code straight from that directory.
Have a look at the wiki to get started. Or you can view the source code of the library.