How to check or uncheck checkbox with script?

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

I would like to check or uncheck the checkbox with a script from a property value; so if that property is true, the checkbox will be checked.

:bust_in_silhouette: Reply From: timothybrentwood

You change CheckBox.pressed = true to have it checked and CheckBox.pressed = false to have it unchecked

In Godot 4 (alpha 5 at least) you do this with _checkbox.button_pressed = true. Using _checkbox.pressed = true will crash your game…

assertchris | 2022-04-07 00:22

Thanks it worked

trollchicken | 2023-04-19 21:26

1 Like