Last active
August 29, 2015 14:14
-
-
Save derekstavis/1f7bbe9c16541b850d3d to your computer and use it in GitHub Desktop.
Kivy Clock performance with and without input enabled
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
| from sys import exit | |
| from kivy.app import runTouchApp | |
| from kivy.uix.widget import Widget | |
| from kivy.clock import Clock | |
| from time import clock | |
| class Events(Widget): | |
| trigger = None | |
| t = clock() | |
| def __init__(self, priority=False, **kwargs): | |
| super(Events, self).__init__(**kwargs) | |
| Clock.schedule_once(lambda dt: exit(0), 10) | |
| self.trigger = Clock.create_trigger(self.callback, timeout=0.001) | |
| self.trigger() | |
| def callback(self, *l): | |
| t = clock() | |
| print 1 / (t - self.t) | |
| self.t = t | |
| self.trigger() | |
| runTouchApp(Events()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment