Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
PyGame
#1
Hi, so I'm having a bit of trouble exiting the Pygame window I created.
I'm pretty new to python so I assumed this would be an issue Here's the code
import pygame

pygame.init()


screen = pygame.display.set_mode([500, 500])


running = True

while running:

    for event in pygame.event.get():

        if event.type == pygame.QUIT:

            running = False

    screen.fill((255, 255, 255))

    pygame.draw.circle(screen, (0, 0, 255), (250, 250), 75)

    pygame.display.flip()

while 1:
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            pygame.display.quit(), sys.exit()
Larz60+ write Dec-08-2020, 08:47 PM:
Please post all code, output and errors (it it's entirety) between their respective tags. Refer to BBCode help topic on how to post. Use the "Preview Post" button to make sure the code is presented as you expect before hitting the "Post Reply/Thread" button.

Fixed for you this time. Please use bbcode tags on future posts.
I also took the liberty to reformat your code
Reply


Messages In This Thread
PyGame - by kat_gamer - Dec-08-2020, 07:12 PM
RE: PyGame - by kat_gamer - Dec-11-2020, 04:31 PM
RE: PyGame - by MK_CodingSpace - Dec-11-2020, 06:08 PM
RE: PyGame - by kat_gamer - Dec-11-2020, 07:08 PM
RE: PyGame - by kat_gamer - Dec-14-2020, 02:51 PM
RE: PyGame - by MK_CodingSpace - Dec-14-2020, 03:48 PM
RE: PyGame - by kat_gamer - Dec-14-2020, 05:01 PM
RE: PyGame - by MK_CodingSpace - Dec-14-2020, 05:59 PM
RE: PyGame - by kat_gamer - Dec-15-2020, 09:38 PM

Forum Jump:

User Panel Messages

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