I'm new to python my main experience is with java, anyway I am running a piece of code from the python IDE.I run
this code and it works correctly and brings up what I expected to see, the problem is is when I click the close button the x in the corner the screen hangs and then comes unresponsive.
But when I go to the py file and double click it the program runs fine and closes correctly.
#!/usr/bin/env python
background_image_filename = "sushiplate.jpg"
mouse_image_filename = "fugu.png"
import pygame
from 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()
Error info
Traceback (most recent call last):
File "C:\Users\Genesis\Desktop\game programming opengl\python game programming\source code\learning code\pygame\hello world\helloWorld.py", line 21, in <module>
exit()
SystemExit
>>>

New Topic/Question
Reply




MultiQuote



|