【发布时间】:2016-04-30 15:21:48
【问题描述】:
对于我正在开发的应用程序,我需要检测屏幕何时翻转。我想到了诸如 on_pause() 或 on_start() 之类的东西,它们位于主应用程序类中,但我一无所获。
有什么建议吗?
谢谢
更新:
作为建议@jligeza,我尝试添加on_rotate,如下所示:
from kivy.core.window import Window
class guiApp(App):
def on_start(self):
## Bind android flip-screen
def _on_flip_screen(ee):
print "flipping"
Window.bind(on_rotate=_on_flip_screen)
但这什么都不做(屏幕旋转时不显示打印)。
我也用on_flip尝试过,但是这个事件导致应用程序在启动时崩溃。
这类问题没有好的解决方案?
【问题讨论】:
标签: python event-handling kivy flip screen-rotation