Layout: QFormLayout === ```python import sys from PyQt5.QtCore import * from PyQt5.QtGui import * from PyQt5.QtWidgets import * def window(): app = QApplication(sys.argv) win = QWidget() fbox = QFormLayout() # First fbox fbox.addRow(QLabel("Name"), QLineEdit()) # Second fbox vbox = QVBoxLayout() vbox.addWidget(QLineEdit()) vbox.addWidget(QLineEdit()) fbox.addRow(QLabel("Address"), vbox) # Third fbox hbox = QHBoxLayout() hbox.addWidget(QRadioButton("Male")) hbox.addWidget(QRadioButton("Female")) hbox.addStretch() fbox.addRow(QLabel("sex"), hbox) # Last fbox hbox = QHBoxLayout() hbox.addWidget(QPushButton("Submit")) hbox.addWidget(QPushButton("Cancel")) fbox.addRow(hbox) win.setLayout(fbox) win.setWindowTitle("PyQt") win.show() sys.exit(app.exec_()) if __name__ == '__main__': window() ```  ## Ref. [https://www.tutorialspoint.com/pyqt5/pyqt5\_qformlayout\_class.htm](https://www.tutorialspoint.com/pyqt5/pyqt5\_qformlayout\_class.htm) ###### tags: `PyQt5`
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up