Reflections on software development

Very python oriented, keeping an eye on the rest of the world though :-)

My first pygame experience

Posted by goofy4u on March 9, 2006

This weekend I tried out a little tutorial with the pygame python library. Everything worked ok except for the window size on startup. On WinXP you have to do some extra trick before the pygame initialization. It isn’t documented explicitly but I figured out it had to be the reason that my window size was minimized on starting up, only after dragging and clicking the window it got to the normal size. But when you add the following extra code you get it right immediately :

if sys.platform == “win32”:
os.environ[‘SDL_VIDEODRIVER’] = ‘windib’

pygame.display.init()
pygame.init()
screen = pygame.display.set_mode((200,100))
for event in pygame.event.get():

# and so on …

Leave a comment