【发布时间】:2019-06-28 16:10:05
【问题描述】:
假设我有一个带有菜单栏的 GUI。
mainMenu = self.menuBar()
mainMenu.setStyleSheet("""QMenuBar { background-color: rgb(45, 45, 48); }""") #Set the background color of the menu bar to black.
testMenu = mainMenu.addMenu('Test') # I want to change the color of this text.
test_dropButton = QAction('Test', self)
test_dropButton = setShortcut('Ctrl+T')
test_dropButton.triggered.connect(self.close)
testMenu.addActtion(test_dropButton)#add button to drop down menu.
如何更改各个菜单 QAction 按钮的文本颜色?我会通过添加到样式表调用QAction::item rgb(r, g, b) 来做到这一点,还是有更有效的方法?
【问题讨论】:
标签: python user-interface pyqt5