사소한 아이의 소소한 스킬/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 QTabWidget, QLabel, QWidget, QVBoxLayout, QApplication, QMessageBox class BaseWindow(QWidget): def __init__(self): super().__init__() self.initUI() def initUI(self): self.tabs = QTabWidget() self.tabs.blockSignals(True) #just for not showing the initial message self.tabs.currentChanged.connect(self.onChange) #changed! self.lbl1 = QLabel("Label 1") self...
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..
주지님
'사소한 아이의 소소한 스킬/PyQT5' 카테고리의 글 목록