Answers for "how to create button in pyqt5"

0

create button in pyqt

# needs to be imported first from from PyQt5.QtWidgets
from PyQt5.QtWidgets import QPushButton
btn = QPushButton("button1") # create it

# now you can add it to your layout
layout = QHBoxLayout() # from PyQt5.QtWidgets import QHBoxLayout
layout.addWidget(btn)
# or you can just add it to the window itself like:
btn = QPushButton("button1", self)
Posted by: Guest on November-28-2020
-2

pyqt5 buttons

b1 = QtWidgets.QPushButton(win)
    b1.setText("click me")
    #b1.move(100,100) to move the button
Posted by: Guest on September-06-2020

Code answers related to "how to create button in pyqt5"

Python Answers by Framework

Browse Popular Code Answers by Language