本文整理匯總了Python中kivy.clock方法的典型用法代碼示例。如果您正苦於以下問題:Python kivy.clock方法的具體用法?Python kivy.clock怎麽用?Python kivy.clock使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類kivy
的用法示例。
在下文中一共展示了kivy.clock方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: add_widget
# 需要導入模塊: import kivy [as 別名]
# 或者: from kivy import clock [as 別名]
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))
示例2: __init__
# 需要導入模塊: import kivy [as 別名]
# 或者: from kivy import clock [as 別名]
def __init__(self, **kwargs):
super(TimeDelta, self).__init__(**kwargs)
from kivy.clock import Clock
Clock.schedule_once(self._init_value)
示例3: runAndroid
# 需要導入模塊: import kivy [as 別名]
# 或者: from kivy import clock [as 別名]
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()