Pygame by example 3: use pygame for presentations like Powepoint

It is easy.

Create a powerpoint, save all the slides as images and then use this script.

# load a spreadsheet
import pygame
import sys
from glob import glob

# main surface
screen = pygame.display.set_mode((960, 540))
# surface 1
clock = pygame.time.Clock()
# to see the surface 1 we blit it in the while loop
# for n, image in enumerate(s)
images = [pygame.image.load(png) for png in glob("images01\\*.png")]


counter = 0
loop = 1
while loop:
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            loop = 0
        if event.type == pygame.KEYDOWN:
            if counter < 7:
                counter += 1
            else:
                counter = 0
    screen.fill((0,0,0))
    screen.blit(images[counter], (0, 0))
    pygame.display.flip()
    clock.tick(10)

pygame.quit()
sys.exit()


Subscribe to the newsletter for updates
Tkinter templates
My youtube channel

Twitter: @pythonprogrammi - python_pygame

Videos

Speech recognition game

Pygame's Platform Game

Other Pygame's posts