“Podstawowe okno Pygame” Kod odpowiedzi

Jak zrobić okno 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

okno 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

Podstawowe okno 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()

Odpowiedzi podobne do “Podstawowe okno Pygame”

Pytania podobne do “Podstawowe okno Pygame”

Więcej pokrewnych odpowiedzi na “Podstawowe okno Pygame” w Python

Przeglądaj popularne odpowiedzi na kod według języka

Przeglądaj inne języki kodu