954,525 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Windows freeze in pygame- Windows

Ive been trying to make a game recently but all pygame windows freeze. i have to use the Task Manager to exit. I also have to use it to exit a fullscreen too. All im doing in my code is opening a blank screen. How can i fix that?

TheSkunkMan
Newbie Poster
6 posts since Jun 2005
Reputation Points: 10
Solved Threads: 0
 

hmm well i've little experience with pygame myself but are you sure your not missing something in your code?
i think you need to type stuff like pygame.init() and you have to flip the display stuff like that, like i said i'm not too sure but if you go on the pygame website http://www.pygame.org they might have something in the documentaion or go on their irc channel
a snippet of your code might be good?
then someone can look at it and see whats wrong

a1eio
Junior Poster
141 posts since Aug 2005
Reputation Points: 26
Solved Threads: 25
 

This the most basic test for PyGame that I have, give it a fly ...
[php]import pygame
from pygame.locals import *

yellow = (255,255,0) # RGB color tuple

# initialise screen
pygame.init()
screen = pygame.display.set_mode((350, 250))
pygame.display.set_caption('Basic Pygame program')

# fill background
background = pygame.Surface(screen.get_size())
background = background.convert()
background.fill(yellow)

# display some text
font = pygame.font.Font(None, 36)
text = font.render("Hello from Monty PyGame", 1, (10, 10, 10))
textpos = text.get_rect()
textpos.centerx = background.get_rect().centerx
background.blit(text, textpos)

# blit everything to the screen
screen.blit(background, (0, 0))
pygame.display.flip()

# event loop
while 1:
for event in pygame.event.get():
if event.type == QUIT:
raise SystemExit
screen.blit(background, (0, 0))
pygame.display.flip()
[/php]
Powerful stuff that SDL, mind you, just a little complex at first blush!

vegaseat
DaniWeb's Hypocrite
Moderator
5,989 posts since Oct 2004
Reputation Points: 1,345
Solved Threads: 1,417
 

In that simple program it still crashes. i'm guessing its something wrong with pygame or my computer. Have u heard of this happening before?

TheSkunkMan
Newbie Poster
6 posts since Jun 2005
Reputation Points: 10
Solved Threads: 0
 

Make sure you have the right version of PyGame downloaded. I use Windows XP and Python24 so I downloaded the installer file:
pygame-1.6.win32-py2.4.exe
from http://www.pygame.org/

vegaseat
DaniWeb's Hypocrite
Moderator
5,989 posts since Oct 2004
Reputation Points: 1,345
Solved Threads: 1,417
 

I understand that PyGame is simply a wrapper for SDL. That creates a problem, Python has a good memory manager, but SDL written in C++ has the usual memory management is up to you thing. THESE TWO WORLDS LIKE TO CLASH AND CRASH!

bumsfeld
Nearly a Posting Virtuoso
1,445 posts since Jul 2005
Reputation Points: 404
Solved Threads: 184
 

I have played around with some of the pygame examples posted on the net, and they don't always behave well! I actually managed to get the "grey screen of death" on Windoze XP!

vegaseat
DaniWeb's Hypocrite
Moderator
5,989 posts since Oct 2004
Reputation Points: 1,345
Solved Threads: 1,417
 

I have it working now, but is there a way a way i can have it so the window doesnt pop asking if u really want to quit?

TheSkunkMan
Newbie Poster
6 posts since Jun 2005
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You