How can I change the width of a patch9frame using script?

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

I am trying to change the width of my patch9frame using script. To do this I have tried:

node.set_ region_ rect(Vector2(x, y), Vector2(300, 100))

I am loading a separate menu, but the labels in this are longer and so i need the patch9frame to be wider.

Thanks

:bust_in_silhouette: Reply From: Aquiles

hi stubbsy345 !

Try this is very simple

The logic
Node patch9frame / width (current width + additional width)

The Code

get_node("p9f").set_size(get_node("p9f").get_size() + Vector2(20,0))

Luck