Change button border to round with script

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

Hello,
How to change the button border to round with script.
Thank you in advance for your help.
Best regards.

for i in range(1, 101):
	var button = Button.new()
	button.text = str(i)
	button.flat = true
	button.modulate = Color(randi_range(50, 150), randi_range(50, 150), randi_range(50, 150), 255) / 255.0
	button.size = Vector2(25, 25)
	button.add_theme_font_size_override("Xolonium-Regular.ttf", 24)
	add_child(button)
:bust_in_silhouette: Reply From: Enfyna
var button = Button.new()
var stylebox = StyleBoxFlat.new()
stylebox.set_corner_radius_all(20)
button.add_theme_stylebox_override("normal",stylebox)
button.add_theme_stylebox_override("pressed",stylebox)
add_child(button)

You can use a stylebox .

It works. Thank you so much :smiley:

Mavitaka | 2023-03-23 13:18