Godot Version
4.2.2
Question
Hi! I am trying to write code that sets the stretch mode to “Expand”. I am not sure how to access, and then set it. I just need some help.
Code
extends Node
func _on_play_button_pressed():
get_tree().change_scene_to_file("res://scenes/levels/level_1.tscn")
func _on_quit_button_pressed():
get_tree().quit(0)
func _on_check_button_toggled(toggled_on):
pass
#This is where i am tring to set the code...
I hope somebody has an answer to my question
Ask me if you need more details 
Hi, first you need a reference to the CheckButton. It looks something like $CheckButton
. You can get the path to the button by dragging the node into the script. There are different size flag variables for horizontal and vertical so use the one you want (size_flags_horizontal
size_flags_vertical
). You should set it to one of the values of the SizeFlags enum (SIZE_EXPAND) in your case
I’m a bit confused on what you ment
you want something like $CheckButton.size_flags_horizontal = Control.SIZE_EXPAND
In the function?
func _on_check_button_toggled(toggled_on):
pass
#In here?
yes, presumably you want something to also happen depending on the value of toggled_on too so you probably need an if else statement as well
So when i am getting a refrence to the checkbutton. I don’t get up the whole size_flags_horizontal
I am probobly doing something wrong
func _on_check_button_toggled(toggled_on):
$CheckButton #I can't get it to show up after here :|
It’s not going to autofill because it doesn’t know that checkbutton is a CheckButton. you need to type it manually
When i switch the checkbutton on theres an error:
E 0:00:02:0301 GameManager_script.gd:14 @ _on_check_button_toggled(): Node not found: "CheckButton" (relative to "/root/Menu_screen/GameManager").
<C++ Error> Method/function failed. Returning: nullptr
<C++ Source> scene/main/node.cpp:1651 @ get_node()
<Stack Trace> GameManager_script.gd:14 @ _on_check_button_toggled()
This is the code. tried to look for misspelings, but i couldn’t find any:
func _on_check_button_toggled(toggled_on):
$CheckButton.size_flags_horizontal = Control.SIZE_EXPAND
Sorry for being kinda anoying 
$CheckButton is just an example, I do not know the actual layout of your scene so I cannot give the actual path. Drag the checkbutton node into the script to get the actual path
So there are no bugs, nor are there any errors. But i may have said something wrong when i asked my question… Because i can’t see a diffrence (If you’re even supossed to see a diffrence). Because the display isn’t covering the entire diplay. It still has those black bars on the side. Again. Sorry for being a bit annoying 
Are you asking how to change the resolution of the game, and not how to change the size flags of a CheckButton?
Yes… mabye. I at least want to get rid of these things on the side:
So i belive it is the reseloution of the game
Thanks! Also, I am so, so sorry for waisting your time 