本文整理汇总了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()