【发布时间】:2017-03-18 16:10:08
【问题描述】:
我有一个 kivy 应用,里面有这个:
Button:
text: "Close"
on_release: app.stop()
这很好用。但不幸的是,当应用程序在 Android 上执行时,应用程序会停止,但不会优雅地打开一个 Android 对话框,说明应用程序已关闭。这不是正常结局的预期行为。
所以我的问题是:如何优雅地关闭 Android 上的 kivy 应用,以免看到这个烦人的对话框?
下面是logcat的输出:
I/python ( 4960): ANSWERS (on_stop in App) = None
I/python ( 4960): screen names = ['welcome']
I/python ( 4960): answers have been saved on disk
I/python ( 4960): closing the SQL connection...
I/python ( 4960): now returning True
I/python ( 4960): [INFO ] [Base ] Leaving application in progress...
I/python ( 4960): ANSWERS (on_stop in App) = None
I/python ( 4960): screen names = ['welcome']
I/python ( 4960): answers have been saved on disk
I/python ( 4960): closing the SQL connection...
I/python ( 4960): now returning True
I/python ( 4960): Python for android ended.
如您所见,App.on_stop() 方法似乎被调用了两次。
感谢您的想法。
【问题讨论】:
标签: android python python-2.7 kivy