I'm trying to create a menu but it's not showing though it should, I'm running this in OSX in case it makes any difference.
import sys
from PyQt5.QtWidgets import QApplication, QDesktopWidget, QMainWindow
class WindowTest(QMainWindow):
def __init__(self):
super().__init__()
self.setGeometry(50, 50, 500, 500)
self.setWindowTitle('Test Window')
win_rectangle = self.frameGeometry()
center_point = QDesktopWidget().availableGeometry().center()
win_rectangle.moveCenter(center_point)
self.move(win_rectangle.topLeft())
self.setStyleSheet('QPushButton:!hover {color: red}')
self.ui()
def ui(self):
menu_bar = self.menuBar()
menu_bar.addMenu('File')
menu_bar.addMenu('Edit')
menu_bar.addMenu('Help')
self.show()
if __name__ == '__main__':
test = QApplication(sys.argv)
test_window = WindowTest()
sys.exit(test.exec_())
The result: