Created
May 26, 2011 07:03
-
-
Save hansent/992686 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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