Python kivy.clock() Examples

The following are 3 code examples of kivy.clock(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module kivy , or try the search function .
Example #1
Source File: gaugeframe.py    From RaceCapture_App with GNU General Public License v3.0 6 votes vote down vote up
def add_widget(self, widget, *args):
        super(GaugeFrame, self).add_widget(widget, 0)
        children = len(self.children)

        if children < 2:
            return

        if children > 2:
            raise Exception('GaugeFrame only allows one widget')

        self.raw_gauge = widget
        try:
            from kivy.clock import Clock
            widget.bind(channel=self._on_title)
            widget.bind(title=self._on_title)
        except AttributeError:
            Logger.warn('No title attribute on {}'.format(widget)) 
Example #2
Source File: timedelta.py    From RaceCapture_App with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, **kwargs):
        super(TimeDelta, self).__init__(**kwargs)
        from kivy.clock import Clock
        Clock.schedule_once(self._init_value) 
Example #3
Source File: guy.py    From guy with Apache License 2.0 3 votes vote down vote up
def runAndroid(ga):
    import kivy
    from kivy.app import App
    from kivy.utils import platform
    from kivy.uix.widget import Widget
    from kivy.clock import Clock
    from kivy.logger import Logger

    def run_on_ui_thread(arg):
        pass

    webView       = None
    webViewClient = None
    #~ webChromeClient = None
    activity      = None
    if platform == 'android':
        from jnius import autoclass
        from android.runnable import run_on_ui_thread
        webView       = autoclass('android.webkit.WebView')
        webViewClient = autoclass('android.webkit.WebViewClient')
        #~ webChromeClient = autoclass('android.webkit.WebChromeClient')
        activity      = autoclass('org.kivy.android.PythonActivity').mActivity



    class Wv(Widget):
        def __init__(self, guyWindow ):
            self.f2 = self.create_webview # important
            super(Wv, self).__init__()
            self.visible = False

            def exit(v):
                activity.finish()
                App.get_running_app().stop()
                os._exit(0)

            guyWindow._callbackExit = exit

            self.ws=WebServer( guyWindow )
            self.ws.start()

            Clock.schedule_once(self.create_webview, 0)

        @run_on_ui_thread
        def create_webview(self, *args):
            webview = webView(activity)
            webview.getSettings().setJavaScriptEnabled(True)
            webview.getSettings().setDomStorageEnabled(True)
            webview.setWebViewClient(webViewClient())
            #~ webview.setWebChromeClient(webChromeClient())
            activity.setContentView(webview)
            webview.loadUrl(self.ws.startPage)

    class ServiceApp(App):
        def build(self):
            return Wv( ga )

    ServiceApp().run()