아미(아름다운미소)

Python PyQt5 combobox 예제 본문

랭귀지/python

Python PyQt5 combobox 예제

유키공 2018. 11. 26. 11:01

Python PyQt5 combobox

import sys
from PyQt5 import QtCore, QtWidgets
from PyQt5.QtWidgets import QMainWindow, QLabel, QGridLayout, QWidget, QComboBox
from PyQt5.QtCore import QSize, QRect    

class ExampleWindow(QMainWindow):
    def __init__(self):
        QMainWindow.__init__(self)

        self.setMinimumSize(QSize(300, 300))    
        self.setWindowTitle("PyQt5 Combobox example") 

        centralWidget = QWidget(self)          
        self.setCentralWidget(centralWidget)   

        # Create combobox and add items.
        self.comboBox = QComboBox(centralWidget)
        self.comboBox.setGeometry(QRect(40, 40, 491, 31))
        self.comboBox.setObjectName(("comboBox"))
        self.comboBox.addItem("Python")
        self.comboBox.addItem("PyQt5")
        self.comboBox.addItem("combobox")
        self.comboBox.addItem("Example")

if __name__ == "__main__":
    app = QtWidgets.QApplication(sys.argv)
    mainWin = ExampleWindow()
    mainWin.show()
    sys.exit( app.exec_() )

'랭귀지 > python' 카테고리의 다른 글

PyQt5 메뉴바(QAction 사용)  (0) 2018.11.30
python 문자열에서 숫자만 제거  (0) 2018.11.27
python 리스트 슬라이싱  (0) 2018.11.25
python json 송수신  (0) 2018.11.24
[python] pyqt5 QTableWidget  (0) 2018.11.23
Comments