Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | Alexandr |
How to change the size of these tabs?
Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | Alexandr |
How to change the size of these tabs?
Reply From: | flurick |
The TabContainer can be styled via:
Custom Style → Tag Fg = New StyleBoxLine
And in that style margins can be set per tab:
StyleBoxLine → Content Margin
Reply From: | binogure |
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
const PADDING_TAB_NAME = 48
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)