Skip to content

Instantly share code, notes, and snippets.

@PaulleDemon
Created October 26, 2021 06:33
Show Gist options
  • Save PaulleDemon/42ca39e3a65c52bd3cae68d5038b63b4 to your computer and use it in GitHub Desktop.
Save PaulleDemon/42ca39e3a65c52bd3cae68d5038b63b4 to your computer and use it in GitHub Desktop.
PyQt layout example
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