+3 votes

How to change the size of these tabs?enter image description here

asked Oct 23, 2018 in Engine by Alexandr (110 points)

2 Answers

+1 vote

The TabContainer can be styled via:
Custom StyleTag Fg = New StyleBoxLine

And in that style margins can be set per tab:
StyleBoxLineContent Margin

answered Oct 23, 2018 by flurick (888 points)
0 votes

If you don't want to use the margin, and you want, let's say, for example center your button title and having the same size over all other tabs, I created this tiny script:

extends Control


func _ready():
for tab_index in range(0, get_tab_count()):
    var tab_title = get_tab_title(tab_index)

    var tab_name_size = tab_title.length()
    var half_pad = ceil((PADDING_TAB_NAME + tab_name_size) / 2.0)
    var tab_title_padded = '%*s' % [half_pad, tab_title]

    tab_title_padded = '%-*s' % [PADDING_TAB_NAME, tab_title_padded]

    set_tab_title(tab_index, tab_title_padded)
answered Nov 23, 2018 by binogure (69 points)
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.