刪除 pyqt5/CODE/元件使用範例/qt05_QListWidget.py
This commit is contained in:
parent
d8cfc23b29
commit
05d265e631
@ -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_())
|
Loading…
Reference in New Issue
Block a user