赞
踩
from PyQt5.QtWidgets import QLabel, QTabBar tab_bar = self.tabWidget.tabBar() for i in range(5): self.tabWidget.setTabText(i, "") # 创建自定义标签 lbl1 = QLabel("标签1") lbl2 = QLabel("标签2") lbl3 = QLabel("标签3") lbl4 = QLabel("标签4") lbl5 = QLabel("标签5") label_list = [lbl1, lbl2, lbl3, lbl4, lbl5] for i in range(5): tab_bar.setTabButton(i, QTabBar.LeftSide, label_list[i]) self.tabWidget.setStyleSheet("QTabBar::tab { height: 35px; }") # 设置标签栏高度
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。