목차

파이썬 PySide 위젯 종류 및 기능(Widget)
이번 포스트는 각 종 체크 박스, 라벨, 버튼, 다이얼, 스위치 등 다양한 위젯에 대해 알아보겠습니다. 각 위쳇을 실제로 구현 해보고 기능에 대해 설명하도록 하겠습니다.
위젯의 상세 사용은 이 후 포스트에서 기록하도록 하겠습니다.
전체 구성 코드>>
from PySide6.QtWidgets import (
QApplication,
QCheckBox,
QComboBox,
QDateEdit,
QDateTimeEdit,
QDial,
QDoubleSpinBox,
QFontComboBox,
QLabel,
QLCDNumber,
QLineEdit,
QMainWindow,
QProgressBar,
QPushButton,
QRadioButton,
QSlider,
QSpinBox,
QTimeEdit,
QVBoxLayout,
QWidget,
)
import sys
class Qt_Ex(QMainWindow):
def __init__(self):
super().__init__()
self.setWindowTitle("Qt Example")
widgets = [
QPushButton,
QRadioButton,
QSlider,
QSpinBox,
QTimeEdit,
QDoubleSpinBox,
QFontComboBox,
QDateEdit,
QDateTimeEdit,
QCheckBox,
QComboBox,
QDial,
QLineEdit,
QProgressBar,
QLCDNumber,
QLabel,
]
layout = QVBoxLayout()
for widget_class in widgets:
print(widget_class)
layout.addWidget(widget_class())
widget = QWidget()
widget.setLayout(layout)
self.setCentralWidget(widget)
app = QApplication(sys.argv)
window = Qt_Ex()
window.show()
app.exec()
결과>>

위젯 종류 및 기능
QPushButton : 버튼

QRadioButton : 토글 버튼으로 클릭 시 마크 됨

QSlider : 슬라이드 바

QSpinBox : 정수 값을 아래 오른쪽 화살표로 변경 가능

QTimeEdit : 시간 변경 창

QDoubleSpinBox : 실수 값을 아래 오른쪽 화살표로 변경 가능

QFontComboBox : 폰트 선택 박스

QDateEdit, QDateTimeEdit :날짜 시간 변경 창

QCheckBox : 체크 박스

QComboBox : 드랍박스 형태로 선택할 수 있는 박스

QDial : 다이얼 제어기

QLineEdit : 텍스트 입력창

QProgressBar : 진행사항 프로그레스바로 표현

QLCDNumber : LCD 표기판

QLabel : 라벨창, 빈칸에 입력값을 넣을 수 있음
'파이썬(Python) > PySide' 카테고리의 다른 글
| [Python] Pyside 레이아웃 설정, 수직, 수평, 겹치기, 그리드(Layout, Vertical, Horizontal, Stack, Grid) (0) | 2022.12.09 |
|---|---|
| [Python] PySide 라벨 위치, 폰트, 글자 크기(Pont, Size, Type) (0) | 2022.12.05 |
| [Python] PySide 라벨 키보드 이벤트 (Lable, Keyboard, Event) (0) | 2022.12.01 |
| [Python] PySide 마우스 이벤트 동작(Mouse event) (0) | 2022.11.25 |
| [PySide6] PyQt란? Hello World 출력하기 (0) | 2022.11.22 |