Python Pygame script to create lines screensaver effect.
import pygame import sys from random import randint # ? 2019 TheFlyingKeyboard and released under MIT License # theflyingkeyboard.net screenXSize = 1920 screenYSize = 1080 backgroundColor = (0, 0, 0) pygame.init() screen = pygame.display.set_mode((screenXSize, screenYSize)) screen.fill(backgroundColor) clock = pygame.time.Clock() fps = 3 while True: for event in pygame.event.get(): if event.type == pygame.QUIT: pygame.quit() sys.exit() if event.type == pygame.KEYDOWN: if event.key == pygame.K_ESCAPE: pygame.quit() sys.exit() if event.key == pygame.K_r: screen.fill(backgroundColor) if event.key == pygame.K_q: fps += 1 if event.key == pygame.K_a: fps -= 1 if fps == 0: fps = 1 pygame.display.set_caption("Lines " + str(fps) + "fps") pygame.draw.line(screen, (randint(0, 255), randint(0, 255), randint(0, 255)), (randint(0, screenXSize), randint(0, screenYSize)), (randint(0, screenXSize), randint(0, screenYSize)), 7) pygame.display.update() msElapsed = clock.tick(fps)