[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] pygame.quit()



Luke Paireepinart schrieb:
DR0ID wrote:
Hello

Under WinXP starting a pygame program from command prompt that does not use the pygame.quit() function will hang while quitting!
It works fine for me.
Well documentation sais:

Uninitialize all pygame modules that have previously been initialized. When the Python interpreter shuts down, this method is called regardless, so your program should not need it, except when it wants to terminate its pygame resources and continue. It is safe to call this function more than once: repeated calls have no effect.


Note, that pygame.quit will not exit your program. Consider letting your program end in the same way a normal python program will end.


I do not know, why it will hang under WinXP (startet at command prompt)? Inserting the line "pygame.quit()" does the trick.
it doesn't for me.
What version of WinXP, what version of Python, and what version of Pygame are you using?
I'm using python 2.4.2 pygame 1.7 on winXP professional.
[snip code]
you meant K_ESCAPE not KEY_ESCAPE.


I used the following code:
#---- start
import pygame
pygame.display.init()
scr = pygame.display.set_mode((640,480))
looping = True
while looping:
for event in pygame.event.get():
print "event"
if event.type == pygame.QUIT:
looping = False
if event.type == pygame.KEYDOWN and event.key == pygame.KEY_ESCAPE:
looping = False
#---- end


Whenever I run it from a command prompt, it closes the pygame window and gives me the prompt back
whenever I press escape or click the X. What makes you think it's hanging?
Hope we get this figured out.
-Luke


Hi

apologies for my premature email. I just tested it in a small examples. It did work as expected, although I have seen it hanging sometimes, but could not reproduce it, sorry. I will watch it more carefully.

Windows-XP-5.1.2600-SP2
2.4.1 (#65, Mar 30 2005, 09:13:57) [MSC v.1310 32 bit (Intel)]
1.7.1release

~DR0ID