Python Forum
[pyGame] My First Test, Error Fount !
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[pyGame] My First Test, Error Fount !
#4
It closes on the x but not the escape key? Did you copy my code or did you type it in. Check for typos. Are you using an IDE? If so which IDE?

I think there were some issues with IDLE in which require sys.exit and pygame.quit such as
import pygame
import sys
 
screen = pygame.display.set_mode((800,600))
done = False
 
while not done:
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            done = True
        elif event.type == pygame.KEYDOWN:
            if event.key == pygame.K_ESCAPE:
                done = True
         
    screen.fill((255,255,255))
    pygame.display.update()
pygame.quit()
sys.exit()
Recommended Tutorials:
Reply


Messages In This Thread
RE: [pyGame] My First Test, Error Fount ! - by metulburr - Sep-25-2017, 04:13 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  [PyGame] Pygame attribute error djwilson0495 3 3,974 Feb-18-2021, 03:34 PM
Last Post: michael1789
Big Grin Error installing Pygame-Zero dpa2007 1 3,195 Dec-26-2020, 03:50 PM
Last Post: MK_CodingSpace
  pygame error in my clicker game CrazyMakes 2 2,570 Apr-19-2020, 03:04 AM
Last Post: Windspar
  Error to install pygame skp 1 3,507 Apr-14-2020, 05:17 PM
Last Post: joe_momma
  installing pygame error pylab 1 4,282 Dec-31-2019, 05:44 PM
Last Post: pylab
  [PyGame] pygame image loading error BlueClaw 6 6,427 Dec-10-2019, 08:50 PM
Last Post: BlueClaw
  Problem with music - Pygame.error GaseBall 1 3,212 Nov-28-2019, 07:46 PM
Last Post: SheeppOSU
  Pygame to exe error Clunk_Head 0 2,991 Oct-19-2019, 01:34 PM
Last Post: Clunk_Head
  [PyGame] Error setting up pygame wazee 10 13,353 Jun-14-2018, 11:19 PM
Last Post: wazee
  Pygame: Help With JackRouter Error arrangereality 4 5,080 Aug-02-2017, 03:28 AM
Last Post: arrangereality

Forum Jump:

User Panel Messages

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