Python embedding question (2).

Pierre-Alain Dorange pdorange at pas-de-pub-merci.mac.com
Wed Jul 30 09:04:56 CEST 2008


Thomas Troeger <thomas.troeger.ext at siemens.com> wrote:

> I've managed to put together a small pyGame program, it runs smoothly
> and seems to be exactly what I wanted. It's fast! Even with 100 moving
> objects it still runs so fast that I can consider using Python/pyGame
> for the whole project.
> 
> There are still some questions left which I haven't found out by myself,
> so maybe someone here can answer them:
> 
> - I can't see how to create more sophisticated text output, it seems the
> built in font render facilities are limited to simple strings. Is that
> true?

Yes, for my part i start to make a (small) library myself for my little
game in development (simple).
Supporting bidirectionnal in such a case is not a big deal, but markups
will be not trivial (but python has tools to parse text, this can help).

Also have a look at somme gui library for pygame : 
        <http://www.pygame.org/tags/gui>
        <http://www.pygame.org/wiki/gui>

It seems PGU is one of the most used.
        <http://www.pygame.org/projects/9/108/>

> - Is there some way to reserve screen areas so they are excluded from a
> blit, or do I have to manage stuff like this myself?

You can blit any rectangle it's trivial. for example group.draw render
the sprites in it, into the surface given, this surface can be the
screen or any other "virtual surface". You just have to render this
"virtual" on screen whn done.

You can also used the more sophisticate "dirty rect"
(group.RenderUdates) or even better group.LayeredUpdates. 
I start with but a can not make all things work properly at that time.

> I am thinking about 
> several graphic layers where each layer is painted on top of the next
> layer, for example to draw a gui in front of a background image.

For this is simply create sprite groups (one per layer) and than call
group render (group.draw) in the order i need. Easy and efficient.

> - There seems to be support for video overlay, i.e. is it possible to
> have an external program paint an image from a camera into a portion of
> the screen while pyGame is running?

Don't know...

-- 
Pierre-Alain Dorange

Ce message est sous licence Creative Commons "by-nc-sa-2.0"
        <http://creativecommons.org/licenses/by-nc-sa/2.0/fr/>



More information about the Python-list mailing list