Last active
December 18, 2015 13:39
-
-
Save KristerV/5791682 to your computer and use it in GitHub Desktop.
This file contains 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
''' | |
Image auto_reload test | |
====================== | |
Testing ground for auto_reload | |
''' | |
import kivy | |
kivy.require('1.8.0') | |
from kivy.app import App | |
from kivy.uix.scatter import ScatterPlane | |
from kivy.uix.image import Image | |
import os | |
from kivy.network.urlrequest import UrlRequest | |
class ImageAutoReloadTest(App): | |
def build(self): | |
try: | |
os.remove('big.jpg') | |
except Exception, e: | |
pass | |
big_source = 'https://lh4.googleusercontent.com/--29goQhTF6k/AAAAAAAAAAI/AAAAAAAAAAA/NKjgVVY3dbg/photo.jpg' | |
big_url = UrlRequest(big_source, self.write_file) | |
img = Image(source='big.jpg', auto_reload=0.5) | |
return img | |
def write_file(self, req, data): | |
big_file = open('big.jpg', 'wb') | |
big_file.write(data) | |
big_file.close() | |
if __name__ == '__main__': | |
ImageAutoReloadTest().run() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment