Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

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)
 
PREVIOUS NEXT
Tagged: #create #button #pyqt
ADD COMMENT
Topic
Name
7+7 =