Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
import kivy
import random, os
from import App
from kivy.uix.image import Image
from kivy.core.window import Window
from kivy.clock import Clock
from kivy.config import Config
class PhotoScreensaver(App):
def __init__(self):
App.__init__(self) = []
def build(self):
keyb = Window.request_keyboard(self.stop, self)
keyb.bind(on_key_down = self.key_pressed)
self.image = Image()
Clock.schedule_interval(self.change_image, 10)
return self.image
def key_pressed(self, keyboard, keycode, text, modifiers):
def change_image(self, whatever = None):
self.image.source = random.choice(
def add_photos(self, nothing, dirname, files):
for file in files:
if file.endswith('.jpg') or file.endswith('.JPG'):, file))
def find_all_photos(app):
os.path.walk('/Users/larsga/data/bilder/privat', app.add_photos, None)
if __name__ == '__main__':
Config.set('graphics', 'fullscreen', '1')
Config.set('graphics', 'size', '0x0')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment