Bonsoir

Je souhaite créer un première fenêtre avec pygame.

Voici le code
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
 
import pygame as pg
import pytmx  as px
import pyscroll as psl
 
def main():
 
    pg.init()
 
    taille_ecran = (800, 600)
    ecran = pg.display.set_mode(taille_ecran)
    NameGame = pg.display.set_caption("Humanity")
    running = True
 
    while running:
 
        for event in pg.event.get():
 
            if event.type == pg.QUIT():
 
                running = False
 
            if event.type == pg.KEYDOWN:
 
                if event.key == pg.K_ESCAPE:
 
                    running = False
 
main()
J'ignore pourquoi, il m'envoi cette erreur.

pygame 2.1.2 (SDL 2.0.18, Python 3.8.10)
Hello from the pygame community. https://www.pygame.org/contribute.html
Traceback (most recent call last):
File "C:\Users\EDMOND\Documents\programme python\humanité game\main.py", line 43, in <module>
main()
File "C:\Users\EDMOND\Documents\programme python\humanité game\main.py", line 31, in main
if event.type == pg.QUIT():
TypeError: 'int' object is not callable

A bientôt