问题
I can't see the close button on individual tabs when using PyQt5. I can close the individual tabs when I click where I know the close button should be, but can't see the button outright:
#!/bin/python3
import sys
from PyQt5.QtWidgets import (QApplication, QVBoxLayout,
QTabBar, QFrame)
class App(QFrame):
def __init__(self):
super().__init__()
self.setWindowTitle("Web Browser")
self.setBaseSize(683, 384)
self.CreateApp()
def CreateApp(self):
self.layout = QVBoxLayout()
self.tab_Bar = QTabBar(movable=True, tabsClosable=True)
self.tab_Bar.tabCloseRequested.connect(self.CloseTab)
self.tab_Bar.addTab("Tab 1")
self.tab_Bar.addTab("Tab 2")
self.tab_Bar.setCurrentIndex(0)
self.layout.addWidget(self.tab_Bar)
self.setLayout(self.layout)
self.show()
def CloseTab(self, i):
self.tab_Bar.removeTab(i)
if __name__ == "__main__":
app = QApplication(sys.argv)
window = App()
sys.exit(app.exec_())
I'm using Python version 3.6.2 and PyQt5 version 5.9
来源:https://stackoverflow.com/questions/46104347/pyqt5-cant-see-close-buttons-in-qtabbar