Skip to content

Instantly share code, notes, and snippets.

@hansent
Created May 26, 2011 07:03
Show Gist options
  • Select an option

  • Save hansent/992686 to your computer and use it in GitHub Desktop.

Select an option

Save hansent/992686 to your computer and use it in GitHub Desktop.
import kivy
kivy.require('1.0.0')
from kivy.app import App
from kivy.uix.image import Image
from kivy.core.image import Image as CoreImage
from kivy.uix.button import Button
from kivy.uix.boxlayout import BoxLayout
from kivy.cache import Cache
from kivy.clock import Clock
from glob import glob
def print_cache(*args):
Cache.print_usage()
class MyApp(App):
def next_image(self):
self.cimg = CoreImage(self.file_list.pop(0))
self.image.texture = self.cimg.texture
def build(self):
self.file_list = glob('cache/products/1280*')
self.cimg = None
self.image = Image()
self.button = Button(text='Load Image', on_press=self.next_image)
layout = BoxLayout()
layout.add_widget(self.image)
layout.add_widget(self.button)
Clock.schedule_interval(print_cache, 1)
return layout
if __name__ in ('__android__', '__main__'):
MyApp().run()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment