By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,275 Members | 1,162 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,275 IT Pros & Developers. It's quick & easy.

Multiple Windows in Pygame, using true concurrency in python via Kamaelia

P: n/a
Just thought some people may be interested to hear that I've recently been
looking at adding true concurrency into Kamaelia, by using Paul Boddie's
pprocess as the core mechanism to allow us to run multiple Kamaelia systems
in the same app. (Since we have thread based, and co-operative generator
based components, process based is the next logical step)


Anyhow, first proof of concept is to take a _relatively_ non-trivial app and
a library hostile to being run in a single process and run it across
multiple processes trivially. (I can't test multicpu since I don't have a
multicpu machine, but this should work fine with a modern OS)

So the app I've chosen is a simple pygame based drawing/doodling app, and to
get it to launch 8 pygame windows from 1 app. Since neither SDL nor pygame
directly support this it struck me as not just a visible proof of concept,
but a useful one too (since pygame rocks! :-)

Anyhow, I've written up the code here and posted a screenshot here:

You'll note 8 pygame windows ... :-)

The original base test is here:

For those curious who don't like clicking on links, the code needed to allow
the 8 pygame windows looks like this:

class SecondProcessBasedComponent(SimplestProcessCompone nt):
def main(self):
from Kamaelia.UI.Pygame.Display import PygameDisplay
from Kamaelia.UI.Pygame.MagnaDoodle import MagnaDoodle

yield 1

exchange = SecondProcessBasedComponent().activate()
R = []
for _ in xrange(7):

So far, so good :-)

Incidentally, yes the project is alive and well, but a resource crunch
at work means I'm working on this only on my own time at the mo, which
means things like releases are having a longer cycle between them than
I'd like. Some recent developments include a greylisting proxy server,
a ER modelling tool and a (very) simple pygame based logo like tool for
teaching programming to small children. The webserver is aiming for WSGI
compliance, and the project also had a small number of students working
over the summer, assisting with some useful things like AIM/IRC integration,
the ability to use Kamaelia systems in non-Kamaelia based scripts/systems,
and looking at a sub-component model. (ie non-concurrent systems)

Dec 2 '07 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.