2010-11-06 22:50:23 +00:00
|
|
|
#!/usr/bin/env python
|
|
|
|
|
|
|
|
from kivy.app import App
|
2010-11-07 22:53:43 +00:00
|
|
|
from kivy.clock import Clock
|
2010-11-06 22:50:23 +00:00
|
|
|
from kivy.lang import Builder
|
|
|
|
|
|
|
|
class KvApp(App):
|
2010-11-07 22:53:43 +00:00
|
|
|
def _print_fps(self, *largs):
|
2010-11-08 01:43:49 +00:00
|
|
|
print 'FPS: %2.4f (real draw: %d)' % (
|
|
|
|
Clock.get_fps(), Clock.get_rfps())
|
2010-11-06 22:50:23 +00:00
|
|
|
def build(self):
|
2010-11-07 22:53:43 +00:00
|
|
|
Clock.schedule_interval(self._print_fps, 1)
|
2010-11-06 22:50:23 +00:00
|
|
|
return Builder.load_file(self.options['filename'])
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
import sys
|
|
|
|
import os
|
|
|
|
|
|
|
|
if len(sys.argv) < 2:
|
|
|
|
print 'Usage: %s filename.kv' % os.path.basename(sys.argv[0])
|
|
|
|
sys.exit(1)
|
|
|
|
|
|
|
|
KvApp(filename=sys.argv[1]).run()
|