pyqt5

import sys from PyQt5.QtWidgets import QApplication, QWidget, QCheckBox, QVBoxLayout from PyQt5.QtCore import Qt class MyApp(QWidget): def __init__(self): super().__init__() self.initUI() def initUI(self): cb = QCheckBox('Show title', self) # Text 설정 cb.setText("SetText") # Text 가져오기 print(cb.text()) # 상태 변경 cb.toggle() # 상태 확인하기 print(cb.isChecked()) # 상태 변경 이벤트 cb.stateChanged.connect(self.cha..
import sys, os from PyQt5.QtWidgets import * class BaseWindow(QWidget): def __init__(self): super().__init__() self.initUI() def initUI(self): self.lbl = QLabel("EXAMPLE") self.btn_1 = QPushButton("QInputDialog") self.btn_1.clicked.connect(self.Input_showDialog) self.btn_2 = QPushButton("QColorDialog") self.btn_2.clicked.connect(self.Color_showDialog) self.btn_3 = QPushButton("QFontDialog") self..
import sys from PyQt5.QtWidgets import QApplication, QWidget, QLabel, QSpinBox, QDoubleSpinBox, QVBoxLayout class MyApp(QWidget): def __init__(self): super().__init__() self.initUI() def initUI(self): self.lbl1 = QLabel('QSpinBox') self.spinbox = QSpinBox() self.spinbox.setMinimum(-10) self.spinbox.setMaximum(30) # self.spinbox.setRange(-10, 30) self.spinbox.setSingleStep(2) self.lbl2 = QLabel('..
import sys from PyQT5.QtWidgets import QApplication, QWidget, QLabel, QDateTimeEdit, QVBoxLayout from PyQT5.QtCore import QDateTime class MyApp(QWidget): def __init__(self): super().__init__() self.initUI() def initUI(self): self.lbl = QLabel('QTimeEdit') self.lbl2 = QLabel('QTimeEdit') self.datetimeedit = QDateTimeEdit(self) self.datetimeedit.setDateTime(QDateTime.currentDateTime()) self.dateti..
import sys from PyQt5.QtWidgets import QApplication, QWidget, QComboBox, QLabel, QVBoxLayout from PyQt5.QtCore import Qt class MyApp(QWidget): def __init__(self): super().__init__() self.initUI() def initUI(self): # 라벨 생성 self.l = QLabel('Option1', self) # 콤보 박스 생성 self.cb = QComboBox(self) # 콤보 아이템 추가 self.cb.addItem('Option1') self.cb.addItem('Option2') self.cb.addItem('Option3') self.cb.addIt..
이번에는 QThread 사용법이다. 다른 언어에서도 다 사용하듯 1개의 쓰레드로 모든 기능을 처리한다는 것은 불가능에 가깝다. 특히나 UI가 있다면 더더욱.. (프리징현상 어쩔꺼야...) 그리하여 이번엔 QTthread이다. 정말 간단한 예제이며 QT에서는 QThread말고 QRunnable 등 다른 여러가지 Thread 사용법들이 있다.. 차차 하나씩 알아보고 이번엔 간단한 QThread만 알아보도록 하자 from PySide6.QtCore import * from PySide6.QtWidgets import * import sys import time # 내 돈 balance = 100 # 돈을 1씩 계속 없애는 QThread class Balance_decrease(QThread): # Custom..
주지님
'pyqt5' 태그의 글 목록