ToggleButton

ToggleButtons are like normal Buttons, but when clicked they remain activated, or pressed, until clicked again.

To retrieve the state of the ToggleButton, you can use the get_active() method. This returns true if the button is "down". You can also set the toggle button's state, with set_active(). Note that, if you do this, and the state actually changes, it causes the "clicked" signal to be emitted. This is usually what you want.

You can use the toggled() method to toggle the button, rather than forcing it to be up or down: This switches the button's state, and causes the toggled signal to be emitted.

Reference