How to make "close" button?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Alexandr

How to make the button shut down the program?

:bust_in_silhouette: Reply From: Xrayez

Connect button’s pressed signal to a method:

enter image description here

Inside the script:

func _on_close_pressed():
    get_tree().quit()

You can also connect pressed signal via code instead:

func _ready():
    $button.connect('pressed', self, '_on_close_pressed')