A menubar can be added to a PyQt window. Its a horizontal bar with buttons items, typically file menu and others.

This example adds a menubar and textbox to a PyQt window. As shown in the screenshot below.

menubar in pyqt

PyQt Menubar

Menubar example

A menubar can be constructed with QMenuBar(). You can add menus like so .addMenu("File"). Then add actions to the menu so .addAction("Open").

The menubar has to be added to a layout, which is done with this line layout.addWidget(menubar, 0, 0).

from PyQt5.QtCore import *
from PyQt5.QtWidgets import *
import sys

class Window(QWidget):
    def __init__(self):
        QWidget.__init__(self)
        layout = QGridLayout()
        self.setLayout(layout)

        # create menu
        menubar = QMenuBar()
        layout.addWidget(menubar, 0, 0)
        actionFile = menubar.addMenu("File")
        actionFile.addAction("New")
        actionFile.addAction("Open")
        actionFile.addAction("Save")
        actionFile.addSeparator()
        actionFile.addAction("Quit")
        menubar.addMenu("Edit")
        menubar.addMenu("View")
        menubar.addMenu("Help")

        # add textbox
        tbox = QPlainTextEdit()
        layout.addWidget(tbox, 1, 0)


app = QApplication(sys.argv)
screen = Window()
screen.show()
sys.exit(app.exec_())