Created
October 26, 2021 06:33
-
-
Save PaulleDemon/42ca39e3a65c52bd3cae68d5038b63b4 to your computer and use it in GitHub Desktop.
PyQt layout example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
from PyQt5.QtWidgets import QApplication, QWidget, QLabel, QPushButton, QVBoxLayout | |
if __name__ == '__main__': | |
app = QApplication(sys.argv) | |
widget = QWidget() | |
v_layout = QVBoxLayout() | |
label = QLabel("Sample label") | |
button = QPushButton("Button") # create an instance of QPushbutton | |
v_layout.addWidget(label) | |
v_layout.addWidget(button) | |
widget.setLayout(v_layout) | |
widget.show() | |
sys.exit(app.exec()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment