PyQt5 技術篇-下拉框綁定監聽事件

currentIndexChanged.connect() 用於監聽當前選擇的索引改變。
即,選擇的內容改變就會觸發!

items = ["腳本錄製", "腳本回放", "腳本管理"]
self.comboBox = QtWidgets.QComboBox()
self.comboBox.addItems(items)
self.comboBox.currentIndexChanged.connect(self.hello)   # 當選擇內容改變時觸發事件

要觸發的事件

def hello(self):
	print("內容改變了")

喜歡的點個贊❤吧!

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章