Let’s get it started. Maybe it will take something more than one minute, but who cares, at least I tried.
The code is simply this.
import pygame import sys pygame.init() width = 1000 height = 800 size = (width, height) screen = pygame.display.set_mode(size) clock = pygame.time.Clock() run = 1 while run: screen.fill((255,255,0)) for event in pygame.event.get(): if event.type == pygame.QUIT: run = 0 pygame.display.flip() clock.tick(60) pygame.quit() sys.exit()
And the video “tutorial” is this. Let’s go, time is running.
To make this window I added this code
import pygame import sys pygame.init() width = 1000 height = 800 size = (width, height) screen = pygame.display.set_mode(size) clock = pygame.time.Clock() font = pygame.font.SysFont("Arial", 36) one = font.render("One minute to make a BLANK window with Pygame",1,(255,0,0)) rect = one.get_rect() rect2 = one.get_rect() rect2.x = width//2 - rect.w//2 rect2.y = height//2 - rect.h//2 run = 1 while run: screen.fill((255,255,0)) for event in pygame.event.get(): if event.type == pygame.QUIT: run = 0 pygame.draw.rect(screen, (128,255,128), rect2) screen.blit(one, (width//2 - rect.w//2,height//2-rect.h//2)) pygame.display.flip() clock.tick(60) pygame.quit() sys.exit()
The video
Subscribe to the newsletter for updates
Tkinter templates
My youtube channel
Twitter: @pythonprogrammi - python_pygame