我们从Python开源项目中,提取了以下3个代码示例,用于说明如何使用kivy.platform()。
def start(self): self.logging_function(u'??????? ?????? ????', 1, time.time()) self.start_reading_osc_queue() if platform == 'android': # self.subprocess = autoclass( # 'org.fogaprod.vkbot.dev.ServiceBotservice') # mActivity = autoclass( # 'org.kivy.android.PythonActivity').mActivity # argument = '' # self.subprocess.start(mActivity, argument) self.subprocess = AndroidService('VKBot', '??? ????????') self.subprocess.start('?????? ???????') else: self.subprocess = subprocess.Popen( ['python2.7', 'service/main.py']) self.start_requesting_answers_count()
def stop(self): self.stop_requesting_answers_count() if platform == 'android': if self.subprocess: # self.subprocess = autoclass( # 'org.fogaprod.vkbot.dev.ServiceBotservice') # mActivity = autoclass( # 'org.kivy.android.PythonActivity').mActivity # argument = '' # self.subprocess.stop(mActivity) self.subprocess.stop() else: osc.sendMsg('/exit', [], port=3000) if self.subprocess is not None: self.subprocess.kill() self.stop_reading_osc_queue() self.logging_function( u'[b]??? ????????? ??????????[/b]', 2, time.time())
def _get_ref(): global _toast if _toast is None: if platform == 'android': from androidtoast import toast else: from kivytoast import toast _toast = toast return _toast