pygame

window refuses to close

Page 1 of 1

2 Replies - 1092 Views - Last Post: 15 August 2008 - 07:51 AM Rate Topic: -----

#1 yanom  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 70
  • Joined: 05-April 08

pygame

Posted 12 August 2008 - 10:31 AM

this is my first program with pygame, and the window doesn't close when i click the X in the top right corner. why is that? I am running ubuntu 8.04 on an Intel
import pygame
from pygame.locals import * 
from sys import exit
pygame.init()
screen = pygame.display.set_mode((600, 440), 0, 32)
pygame.display.set_caption('pygame')
while True:
	for event in pygame.event.get():
		if event == QUIT:
			exit()
	pygame.display.update()


This post has been edited by yanom: 12 August 2008 - 10:40 AM


Is This A Good Question/Topic? 0
  • +

Replies To: pygame

#2 BetaWar  Icon User is offline

  • #include "soul.h"
  • member icon

Reputation: 1199
  • View blog
  • Posts: 7,309
  • Joined: 07-September 06

Re: pygame

Posted 12 August 2008 - 12:48 PM

You need to look at the event type right now you are calling the event but that just says what has happened, if the event.type == QUIT then it is supposed to close. event will never = QUIT.

Try this:

import pygame
from pygame.locals import * 
from sys import exit
pygame.init()
screen = pygame.display.set_mode((600, 440), 0, 32)
pygame.display.set_caption('pygame')
while True:
	for event in pygame.event.get():
		if event.type == QUIT:
			exit()
	pygame.display.update()


HTH
Was This Post Helpful? 0
  • +
  • -

#3 yanom  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 70
  • Joined: 05-April 08

Re: pygame

Posted 15 August 2008 - 07:51 AM

o. thanks for the help, that worked.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1