Pygame




Doc officiel : https://www.pygame.org/docs

Installation de Pygame



pip install pygame



Structure de base



#coding:utf-8

import pygame

"""
pygame.FULLSCREEN
pygame.RESIZABLE
pygame.NOFRAME

pygame.OPENGL
pygame.HWSURFACE
pygame.DOUBLEBUF
"""

resolution = (640, 480)

pygame.init()

fenetre = pygame.display.set_mode(resolution, pygame.RESIZABLE)

#print(pygame.display.Info())
#print(pygame.get_sdl_version())

lancer = True

while lancer:
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            lancer = False



Astuces




Afficher des informations sur le display



print(pygame.display.Info())


Résultat:

images/64-1.png

Afficher la version du sdl



print(pygame.get_sdl_version())


Résultat:

images/64-2.png


Mots clé



pygame.display.set_caption

pygame.display.set_caption("titre de la fenetre")


Résultat:

images/64-3.png