+1 vote

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

in Engine by (292 points)
retagged by

1 Answer

+2 votes
Best answer

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

by (84 points)
selected by
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.