如何在QTabWidget上删除多余的“边框”?

时间:2019-06-25 06:58:38

标签: python python-3.x pyqt pyqt5 qtstylesheets

我有以下输出:

Sample Image

来自以下简单的Tab类:

class TabBar(QTabBar):
    def __init__(self, parent=None):
        super(TabBar, self).__init__(parent)
        self.setStyleSheet('''QTabBar:tab {
                            border-image: url(resources/images/tab_bar2.png)}
                            QTabBar:pane {border: 0px; padding: 0px; margin:0px}
                           ''')
    def tabSizeHint(self, index):
        return QSize(90, 40)


class TabWidget(QTabWidget):
    def __init__(self, parent=None):
        super(TabWidget, self).__init__(parent)
        self.setTabBar(TabBar(self))

        self.setStyleSheet('''
                            QTabWidget::tab-bar {
                                alignment: center;}
                            QTabWidget:pane{border: 0px}''')

我正在尝试删除选项卡顶部的灰线。我尝试将/ border / margins / padding / setContentsMargins设置为0,但仍然没有结果。我没有添加任何涉及灰线的内容,因此我对为什么或如何发生感到困惑。

1 个答案:

答案 0 :(得分:0)

我找到了答案here 我只需要基本添加: import matplotlib.pyplot as plt import numpy as np Traceback (most recent call last): File "barcode.py", line 1, in <module> import matplotlib.pyplot as plt File "C:\Program Files\Python36\lib\site-packages\matplotlib\__init__.py", line 200, in <module> _check_versions() File "C:\Program Files\Python36\lib\site-packages\matplotlib\__init__.py", line 194, in _check_versions module = importlib.import_module(modname) File "C:\Program Files\Python36\lib\importlib\__init__.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) ImportError: DLL load failed: The specified module could not be found.