[BeYourself] PyQt Widgets & Layouts
Widgets
| Widget | What it does |
|---|---|
| QCheckbox | A checkbox |
| QComboBox | A dropdown list box |
| QDateEdit | For editing dates and datetimes |
| QDateTimeEdit | For editing dates and datetimes |
| QDial | Rotatable dial |
| QDoubleSpinbox | A number spinner for floats |
| QFontComboBox | A list of fonts |
| QLCDNumber | A quite ugly LCD display |
| QLabel | Just a label, not interactive |
| QLineEdit | Enter a line of text |
| QProgressBar | A progress bar |
| QPushButton | A button |
| QRadioButton | A toggle set, with only one active item |
| QSlider | A slider |
| QSpinBox | An integer spinner |
| QTimeEdit | For editing times |
Layouts
| Layout | Behaviour |
|---|---|
| QHBoxLayout | Linear horizontal layout |
| QVBoxLayout | Linear vertical layout |
| QGridLayout | In indexable grid XxY |
| QStackedLayout | Stacked (z) in front of one another |
QVboxlayout
filled from top to bottom.

QHboxlayout
filled from left to right.

QGridLaytout
widgets arranged in a grid

QStackedLayout
Multiple widgets in the same space





Nesting Layout
.addLayout 을 이용해 layout을 nesting 할 수 있음.
class MainWindow(QMainWindow):
def __init__(self):
super(MainWindow, self).__init__()
self.setWindowTitle("My App")
layout1 = QHBoxLayout()
layout2 = QVBoxLayout()
layout3 = QVBoxLayout()
layout2.addWidget(Color('red'))
layout2.addWidget(Color('yellow'))
layout2.addWidget(Color('purple'))
layout1.addLayout( layout2 )
layout1.addWidget(Color('green'))
layout3.addWidget(Color('red'))
layout3.addWidget(Color('purple'))
layout1.addLayout( layout3 )
widget = QWidget()
widget.setLayout(layout1)
self.setCentralWidget(widget)
Author And Source
이 문제에 관하여([BeYourself] PyQt Widgets & Layouts), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://velog.io/@toezilla/BeYourself-PyQt-Widgets저자 귀속: 원작자 정보가 원작자 URL에 포함되어 있으며 저작권은 원작자 소유입니다.
우수한 개발자 콘텐츠 발견에 전념
(Collection and Share based on the CC Protocol.)