Can't adjust TextureFrame size according to window size

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Voyga
:warning: Old Version Published before Godot 3 was released.

I’m using following code to resize my TextureFrame:

var window_size = OS.get_window_size()

self.frame.set("rect/size", window_size)

this works when I’m enlarging my window, but it doesn’t work when I’m trying to shrink the window, it goes like this:

1

(the TextureFrame is that black frame)

:bust_in_silhouette: Reply From: YeOldeDM

You should be able to use Anchors to allow your Control nodes to resize themselves to your viewport.
Take your top node Control and make sure its size fills the viewport; Edit > Expand to Parent (the root viewport is your top node’s parent in this case). Find the Anchor button and set it to Full Rect.
Anchors are applied relative to their parent. So with the TextureFrame as a parent of the top node Control, you can do the same: Expand to parent and Anchor Full Rect.