Start with pyglet or pygame?

pygame is richly active, witness the Aug release of 1.9 with nokia s60 support, enhanced py2app/py2exe support, and a bevvy of experimental features (support for Python 3.1, webcams, gfx, …). Books like Hello World and periodic, fun competitions like ludumdare and pyweek bear witness to the vitality of its community and ecosystem. pyglet has a neat, newer API, and is convenient … Read more

Countdown timer in Pygame

On this page you will find what you are looking for http://www.pygame.org/docs/ref/time.html#pygame.time.get_ticksYou download ticks once before beginning the countdown (which can be a trigger in the game – the key event, whatever). For example:

How to get keyboard input in pygame?

You can get the events from pygame and then watch out for the KEYDOWN event, instead of looking at the keys returned by get_pressed()(which gives you keys that are currently pressed down, whereas the KEYDOWN event shows you which keys were pressed down on that frame). What’s happening with your code right now is that if your game is rendering at … Read more

How to display text in pygame?

You can create a surface with text on it. For this take a look at this short example: This creates a new object on which you can call the render method. This creates a new surface with text already drawn onto it. At the end you can just blit the text surface onto your main screen. Bear … Read more

How do I detect collision in pygame?

In PyGame, basic collision detection can be done using pygame.Rect objects. The Rect object offers various methods for detecting collisions between objects. Note that even the collision of a rectangular object with a circular object such as a paddle and a ball in Pong game can be roughly detected by a collision between two rectangular objects, the paddle and the bounding … Read more

pygame.error: video system not initialized

You should stop your main loop when you want to exit the game. My suggestions, either of call exit() after pygame.quit() set finish = True and start = False (though due to some indentation issues with your pasted code it’s not possible to tell that this would actually work) You should call pygame.quit() only when you want to terminate your Python session. My suggestion: … Read more

How to draw a circle in PyGame?

Hi I am having a problem with drawing a circle ERROR: module object has no attribute ‘circle’. what am I doing wrong? And also how can I put numbers in circles? For example: (first click is circle with 0 second is circle with 1 and so on)