Playing with Pygame
It's been a while since I posted. As you know, I recently started a new job, and well, I've been busy! Very, very busy. There has not been much time to work on the blog or fun side projects.
But then I thought, I reaalllly, really need some light relief - so I fired up Pygame. I've been aware of Pygame for years, but never really had the time to play with it.
I've found it easy to get started with, and the documentation is great too. You can get straight to the things you want easily, and there are plenty of examples. Generally the library is very well-thought out, and simple to use.
I managed to get a quick demo running, with lots of alpha-blended bubbles bouncing around. Then I got the bubbles to grow, shrink, and die. Then I added music. It was all very simple and a lot of fun.
The code is on my GitHub. There are a few other test programs there too.
Here's a quick snippet to show you how you play music with Pygame:
import pygame pygame.init() pygame.mixer.music.load("data/Komiku_Sunset_on_the_beach.mp3") pygame.mixer.music.play(-1) # -1 repeats music ...
It really is that simple!
Check out Pygame and have fun!
Update Sat 6 Mar 2021 14:47:25 GMT
I did a little more work on the bubbles program. It's really nice to have a little project that's fun, and that you can pick up and play with for a few minutes and then put to one side if something else comes up. Bubbles has been great for that - a fun little diversion I can dive into when the mood takes. I've also now created a little video of what I expect will be the final version. Sorry the quality is not great. My GitHub repo has also been updated with the latest code. Have fun!
- EJB for providing the fantastic background artwork - Dreams.
- I would like to thank Komiku for providing the dreamy music.