“Janela básica do pygame” Respostas de código

Como fazer uma janela de 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

Janela do 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

Janela básica do 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()

Respostas semelhantes a “Janela básica do pygame”

Perguntas semelhantes a “Janela básica do pygame”

Mais respostas relacionadas para “Janela básica do pygame” em Python

Procure respostas de código populares por idioma

Procurar outros idiomas de código