I am learning pygame using begining game development w/ python and pygame.
I am doing 'Hello World Redux"
#!/usr/bin/env python
background_image_filename = 'sushiplate.jpg'mouse_image_filename = 'fugu.png'
import pygamefrom pygame.locals import *from sys import exit
pygame.init()
screen =
pygame.display.set_mode((640,480),0,32)pygame.display.set_caption("Hello,
World")
background = pygame.image.load(background_image_filename).convert()mouse_cursor
= pygame.image.load(mouse_image_filename).convert_alpha()
while True:
for event in pygame.event.get(): if event.type == QUIT:
exit()
screen.blit(background,(0,0))
x,y = pygame.mouse.get_pos() x -= mouse_cursor.get_width() / 2 y -=
mouse_cursor.get_height() / 2 screen.blit(mouse_cursor, (x,y))
pygame.display.update()This is the code and I am pretty sure it is same as
in the book.
but when I try to close the pygame window I get an error
Traceback (most recent call last): File
"C:\Python25\pythonGameProg\hellowworld redux.py", line 22, in <module>
exit()SystemExit
I am trying to figure out how to get the window to close without the error and
to make it so I don't have to close the window by using the taskmanager. Any
susgestions would be very helpful.
_________________________________________________________________
It’s a talkathon – but it’s not just talk.
http://www.imtalkathon.com/?source=EML_WLH_Talkathon_JustTalk
_______________________________________________
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor