Skip to content

Instantly share code, notes, and snippets.

@shelbyKiraM
Created July 1, 2012 00:18
Show Gist options
  • Save shelbyKiraM/3026159 to your computer and use it in GitHub Desktop.
Save shelbyKiraM/3026159 to your computer and use it in GitHub Desktop.
Viewer/voter for my wallbase scraper
import sys
import os
import pygame
import shutil
from pygame.locals import *
prefix = "C:\\walls\\"
images = []
for filename in os.listdir(prefix):
if (filename[0:9] == "wallpaper"):
images.append(filename)
pygame.init()
size = width, height = 1920, 1200
screen = pygame.display.set_mode(size, pygame.FULLSCREEN)
pygame.mouse.set_visible(0)
currentView = 0
changed = False
print os.getcwd()
os.chdir(prefix)
currentImage = pygame.image.load(images[0])
print os.getcwd()
while 1:
for event in pygame.event.get():
if event.type == KEYDOWN and event.key == K_ESCAPE:
sys.exit()
elif event.type == KEYDOWN and event.key == K_RIGHT:
if currentView + 1 <= len(images):
currentView += 1
changed = True
elif event.type == KEYDOWN and event.key == K_LEFT:
if currentView - 1 >= 0:
currentView -= 1
changed = True
elif event.type == KEYDOWN and event.key == K_DOWN:
shutil.move(images[currentView], "delete")
images.remove(images[currentView])
changed = True
elif event.type == KEYDOWN and event.key == K_UP:
shutil.move(images[currentView], "great")
images.remove(images[currentView])
changed = True
if changed:
currentImage = pygame.image.load(images[currentView])
changed = False
screen.blit(currentImage, (0, 0))
pygame.display.flip()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment