Pygame (Python Game Development) Tutorial – 4 – Quit Event Handling

[ad_1]
Facebook –
GitHub –
Google+ –
LinkedIn –
reddit –
Support –
thenewboston –
Twitter –


Posted

in

by

Tags:

Comments

32 responses to “Pygame (Python Game Development) Tutorial – 4 – Quit Event Handling”

  1. lolthefreef :D Avatar

    expected an indented (gameExit)

    Please help

  2. Pratik Bhangale Avatar

    Event object is not callable for line 9

  3. ajay malik Avatar

    AttributeError: module 'pygame.time' has no attribute 'CLock'
    how to resolve this error.

  4. Suraj Bhan Singh Avatar

    where is source code available on github?..please provide me the full link i cant find where it is

  5. gaurav thakur Avatar

    i am getting error which says =>
    if event.type == pygame.QUIT():
    TypeError: 'int' object is not callable

  6. ZoommaiR Avatar

    How different is this series from the one on Sentdex's own channel? They look almost identical.

  7. Captain Rhodes Avatar

    any reason you dont import the parameters from pygame so you dont have to write pygame.thing all the time?

  8. Ernesto Ibarrola Avatar

    AttributeError: module 'pygame' has no attribute 'dysplay' help

  9. Zen Avatar

    i like reading documents

  10. Jamel Stringer Avatar

    My Plan is to watch 10 videos a day for 10 days! Gotta have a strategy cause my body does not want to watch 100 videos, I'ma do it though!

  11. iAm Voidz Avatar

    I did the pygame.QUIT part, but i still can't exit… what am i doing wrong? please help 🙁

    import pygame

    pygame.init()

    gameDisplay = pygame.display.set_mode((800,600))
    pygame.display.set_caption('Slither')

    pygame.display.update()

    gameExit = False

    while not gameExit:
    for event in pygame.event.get():
    if event.type == pygame.QUIT:
    gameExit == True

    pygame.quit()
    quit()

  12. Douglas Lenz Avatar

    Is there any reason not to use while True: … break as opposed to a bool like gameExit? Just thinking about improving readability

  13. Kevin Avatar

    I got this error:

    if event.type == pygame.QUIT():

    TypeError: 'int' object is not callable

  14. Manning Unger Avatar

    Dude thanks for making these vids!

  15. Mohit Anand Avatar

    Great one sir, but can anyone tell me what this gameDisplay is for? He told in the previous video that it is the game surface which will be updated, but in the updating statement gameDisplay is obviously NOT used..

  16. fabiolus2007 Avatar

    this is awesome!!!!!

  17. Alen Rovcanin Avatar

    I cant Quit out of the windows by clicking the x button.
    import pygame

    pygame.init()

    gamedisplay = pygame.display.set_mode ((800,600))
    pygame.display.set_caption ('snake')

    pygame.display.update()
    while True:
    pass

    gameExit = False

    while not gameExit:
    for event in pygame.event.get():
    if event.type == pygame.QUIT:
    gameExit = True

    #print(event)

    pygame.quit()
    quit()
    What am I doing wrong?

  18. Alberto Antonio Pérez Martín Avatar

    Man, you saved my life and initiated my life in pygame. Really, thanks. Keep the good job. 😀 Greeting from México.

  19. Santosh Paudel Avatar

    I love you, man! You are a really great teacher

  20. Mike A. Avatar

    TIP: if you don't like referencing QUIT or other Pygame variables with pygame.QUIT add from pygame.locals import * to your code under inport pygame

  21. Sophrosynicle Avatar

    I'm gonna make the greatest game everrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr.

  22. Andrew Thoman Avatar

    I am getting this error, anyone know why?
    File "pygameTest.py", line 14, in <module>
        if event.type == pygame.QUIT():
    TypeError: 'int' object is not callable

    Below is my code:

    import pygame

    pygame.init()

    gDisplay = pygame.display.set_mode((800, 600))
    pygame.display.set_caption('DogBaller')

    pygame.display.update()

    gExit = False

    while not gExit:
        for event in pygame.event.get():
            if event.type == pygame.QUIT():
                print(event)
                gExit = True
            print(event)

    pygame.quit()
    quit()

  23. Protoss Pylon Avatar

    I love how as the video number goes up, the view count goes down.

  24. Bradley Carls Avatar

    No offense to Bucky cause I LOVE him, but this guy's pygame tutorials stuck with me a whole lot more than Bucky's did.
    So, thank you. I love both you guys for helping me teach myself 🙂

  25. TheMuffinCoder Avatar

    Best pygame series ever!!! Too bad that after each video the view count seems to decrease

  26. Daniil Dimitrov Avatar

    Thx dude! You are awesome!

  27. Spiros Kaftanis Avatar

    it seems to be a very good tutorial!  Keep going!!

Leave a Reply

Your email address will not be published. Required fields are marked *