Search code examples
pythonfiremonkey

How to close a Python FMX GUI App with a button click?


Is there a built-in function for closing the app via code?

How would I close the app via code instead of clicking on the closing button in the title bar?

I'm using DelphiFMX GUI Library for Python


Solution

  • You can simply use the following line of code in your Button click event:

    Application.Terminate()
    

    This will completely terminate the app and free it from the memory.


    If you're on the MainForm, then you can also use the following line of code to Close the MainForm which in turn will also Terminate the app and free it from the memory:

    self.Close()