刪除 pyqt5/CODE/元件使用範例/qt05_QListWidget.py

This commit is contained in:
M11212051 2024-05-05 22:36:15 +08:00
parent d8cfc23b29
commit 05d265e631

View File

@ -1,30 +0,0 @@
# -*- coding: utf-8 -*-
'''
簡介
PyQT5中QListWidget範例
'''
import sys
from PyQt5.QtCore import *
from PyQt5.QtGui import *
from PyQt5.QtWidgets import *
class ListWidget(QListWidget):
def clicked(self,item):
QMessageBox.information(self, "ListWidget", "您選擇了:"+item.text())
if __name__ == '__main__':
app = QApplication(sys.argv)
listWidget = ListWidget()
listWidget.resize(300,120)
listWidget.addItem("Item 1");
listWidget.addItem("Item 2");
listWidget.addItem("Item 3");
listWidget.addItem("Item 4");
listWidget.setWindowTitle('QListwidget範例')
listWidget.itemClicked.connect(listWidget.clicked)
listWidget.show()
sys.exit(app.exec_())