我只是在学习 Python 和 Kivy 框架.我似乎找不到任何能够使用链接到按钮的代码优雅地退出 Kivy 应用程序的具体完整示例.
I'm just learning Python and the Kivy framework. I can't seem to find any specific complete examples of being able to gracefully exit a Kivy app using code linked to a button.
我发现了这样的 Kivy 代码片段
I have found Kivy code snippets like this
Button:
id:btnExit
text:"Exit"
on_press: app.Exit()
但没有实现 app.Exit() 调用的任何匹配代码.我尝试过的所有操作都会停止代码执行,但不会清理程序窗口.
But not any matching code that implements the app.Exit() call. Everything I've tried stops code execution but doesn't clean up the program window.
我已阅读 Android 和 iOS 样式指南声明程序不会以编程方式退出并让操作系统处理它,但我正在开发全屏无边框桌面应用程序,并且需要一种通过按下按钮退出程序的方法.
I've read that Android and iOS style guides state that a program is not to programmatically exit and let the OS handle it but I am developing fullscreen borderless Desktop app and need a way to exit the program with a button press.
尝试使用 App.get_running_app().stop().
有关详细信息,请阅读 Kivy 文档文章为函数.
这篇关于如何使用按钮退出 Kivy 应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!
如何制作一个在 Python 中提供角色的不和谐机器人How to make a discord bot that gives roles in Python?(如何制作一个在 Python 中提供角色的不和谐机器人?)
Discord 机器人没有响应命令Discord bot isn#39;t responding to commands(Discord 机器人没有响应命令)
你能得到“关于我"吗?Discord 机器人的功能?Can you Get the quot;About mequot; feature on Discord bot#39;s? (Discord.py)(你能得到“关于我吗?Discord 机器人的功能?(不和谐.py))
message.channel.id Discord PYmessage.channel.id Discord PY(message.channel.id Discord PY)
如何在 heroku 上托管我的 discord.py 机器人?How do I host my discord.py bot on heroku?(如何在 heroku 上托管我的 discord.py 机器人?)
discord.py - 自动更改角色颜色discord.py - Automaticaly Change an Role Color(discord.py - 自动更改角色颜色)