Python Forum
Unable to exit Pygame window
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Unable to exit Pygame window
#1
Hello friends I am new to pygame and python. The thing is I am not able to exit the python program even after I click the exit button on the pygame window. Here is my code:
import pygame
import sys

pygame.init()

WIDTH = 800
HEIGHT = 600

screen = pygame.display.set_mode((WIDTH, HEIGHT))

gameOver = False

while not gameOver:
	for event in pygame.event.get():
		if event.type == pygame.QUIT:
			sys.exit()
And instead I get this as output:
Output:
Traceback (most recent call last): File "/home/my-dell/dev/Documents/Programming projects/Practical_Python/atbsp.py", line 16, in <module> sys.exit() SystemExit
Thanks in advance. I am using Ubuntu 16.04 LTS.
Reply


Messages In This Thread
Unable to exit Pygame window - by Hesper - Mar-27-2020, 12:11 PM
RE: Unable to exit Pygame window - by SheeppOSU - Mar-27-2020, 05:19 PM
RE: Unable to exit Pygame window - by Hesper - Mar-30-2020, 08:59 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  [PyGame] Cannot display anything inside pygame window the_gullwing 5 1,456 Dec-07-2023, 02:44 AM
Last Post: Benixon
  [PyGame] drawing images onto pygame window djwilson0495 1 3,608 Feb-22-2021, 05:39 PM
Last Post: nilamo
  pygame get window position vskarica 3 6,134 Oct-18-2020, 05:14 PM
Last Post: nilamo
  [pyGame] More Text in one Window, example needed ! JamieVanCadsand 1 3,661 Oct-03-2017, 03:42 PM
Last Post: metulburr

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020