“Как сделать окно пигаме” Ответ

Пример экрана Python Pygame

import pygame
background_colour = (255,255,255)
(width, height) = (300, 200)
screen = pygame.display.set_mode((width, height))
pygame.display.set_caption('Tutorial 1')
screen.fill(background_colour)
pygame.display.flip()
running = True
while running:
  for event in pygame.event.get():
    if event.type == pygame.QUIT:
      running = False
Depressed Dog

Как сделать окно пигаме

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

окно пигаме

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

Основное окно 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()

Сделайте базовое окно Pygame

import pygame # Have to install pygame with 'pip install pygame'
pygame.init() # Initialize pygame

window = pygame.display.set_mode((800, 600)) # Window size
pygame.display.set_caption('Window name')

run = True
while run:
  for event in pygame.event.get():
    if event.type == pygame.QUIT: # If x button on window is pushed
      run = False # Exit while loop
  
  window.fill((255, 0, 0)) # Fill window with red
  pygame.display.update() # Update the window to show the colour red
  
pygame.quit() # Quit pygame
Ninja Penguin

окно пигаме

# import the pygame module, so you can use it
import pygame
 
# define a main function
def main():
     
    # initialize the pygame module
    pygame.init()
    # load and set the logo
    logo = pygame.image.load("logo32x32.png")
    pygame.display.set_icon(logo)
    pygame.display.set_caption("minimal program")
     
    # create a surface on screen that has the size of 240 x 180
    screen = pygame.display.set_mode((240,180))
     
    # define a variable to control the main loop
    running = True
     
    # main loop
    while running:
        # event handling, gets all event from the event queue
        for event in pygame.event.get():
            # only do something if the event is of type QUIT
            if event.type == pygame.QUIT:
                # change the value to False, to exit the main loop
                running = False
     
     
# run the main function only if this module is executed as the main script
# (if you import this as a module then nothing is executed)
if __name__=="__main__":
    # call the main function
    main()
Crowded Chicken

Ответы похожие на “Как сделать окно пигаме”

Вопросы похожие на “Как сделать окно пигаме”

Больше похожих ответов на “Как сделать окно пигаме” по Python

Смотреть популярные ответы по языку

Смотреть другие языки программирования