I Need to create a menubar with multicolour text. For example, In My menubar, My first item name is "File", The first letter of the Item name is in red colour and the remaining letters are in some other different colours. For a More Clear cut Idea, I Enclose a ScheernShot.
import sys
from PyQt5 import QtWidgets
from PyQt5.QtWidgets import QMainWindow
from PyQt5.QtCore import QSize
class MainWindow(QMainWindow):
def __init__(self):
QMainWindow.__init__(self)
self.setMinimumSize(QSize(300, 100))
self.setWindowTitle("PyQt menu example ")
self.aa = 0
self.intialGui()
def intialGui(self):
menu = self.menuBar()
menu_file = menu.addMenu("&File")
menu_accounts = menu.addMenu("&Accounts")
menu_inventory = menu.addMenu('<font color="red"><u>I</u></font><font color="black">nventroy</font>')
if __name__ == "__main__":
app = QtWidgets.QApplication(sys.argv)
mainWin = MainWindow()
mainWin.show()
sys.exit( app.exec_() )