“fenêtre de base pygame” Réponses codées

comment faire une fenêtre pygame

import pygame 
pygame.init()

"""this is how to make a pygame window, the 500,500 is the size of the window
btw(it is your choice what the size is ) """

var = pygame.display.set_mode((500,500))

"""this is how to change the title of the window"""
pygame.display.set_caption('example')
Prickly Pollan

fenêtre pygame

import pygame
pygame.init()

SCREEN_WIDTH = 500
SCREEN_HEIGHT = 500

screen = pygame.display.set_mode((SCREEN_WIDTH, SCREEN_HEIGHT))
pygame.display.set_caption('game')
clock = pygame.time.Clock()

#colors
BLACK = (0, 0, 0)
WHITE = (255, 255, 255)
GREEN = (0, 255, 0)
RED = (255, 0, 0)
BLUE = (0, 0, 255)

running = True
while running:
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            running = False
            
            screen.fill(BLACK)
            
            
    pygame.display.update()
    clock.tick(60)
    
    
pygame.quit()
quit()
Average Anaconda

fenêtre de base pygame

import pygame
pygame.init()

WIDTH, HEIGHT = 500, 500
WIN = pygame.display.set_mode((WIDTH, HEIGHT))
pygame.display.set_caption("Hello World!")

run = True
while run:
  for event in pygame.event.get():
    if event.type == pygame.QUIT:
      run = False
      break

pygame.quit()

Réponses similaires à “fenêtre de base pygame”

Questions similaires à “fenêtre de base pygame”

Plus de réponses similaires à “fenêtre de base pygame” dans Python

Parcourir les réponses de code populaires par langue

Parcourir d'autres langages de code