1# needs to be imported first from from PyQt5.QtWidgets
2from PyQt5.QtWidgets import QPushButton
3btn = QPushButton("button1") # create it
4
5# now you can add it to your layout
6layout = QHBoxLayout() # from PyQt5.QtWidgets import QHBoxLayout
7layout.addWidget(btn)
8# or you can just add it to the window itself like:
9btn = QPushButton("button1", self)