How to exit the Kivy application using the button

I am just learning Python and Kivy. I cannot find any concrete examples of how to gracefully exit the Kivy application using the code associated with the button.

I found Kivy code snippets like this

Button:
    id:btnExit
    text:"Exit"
    on_press: app.Exit()

But not any code that implements a call app.Exit(). Everything that I tried stops the code execution, but does not clear the program window.

I read that the Android and iOS style guides say that the program should not programmatically exit and allow the OS to process it, but I am developing a full-screen application with no margins for the desktop and I need a way to exit the program by pressing a button.

+4
source share
2 answers

App.stop(* larges):

Button:
    id: btnExit
    text: "Exit"
    on_press: app.stop() 
+10

Source: https://habr.com/ru/post/1606166/


All Articles