我添加代碼到我的應用程序打開圖像序列與兩個按鈕prev和next。 我怎麼可以設置下一個按鈕每秒點擊,例如播放序列?PyQt5循環圖像序列automaticaly
def nextitem(self):
self.listWidget.sortItems()
#a = self.choice2.text()
count = self.listWidget.count()
cur = self.listWidget.currentRow()
self.listWidget.setCurrentRow(cur+1)
if (cur+1) == count:
self.listWidget.setCurrentRow(0)
if len(self.choice2.text()) > 0:
tex = self.listWidget.currentItem().text()
a = self.video_choice_2.setText(tex)
self.playVideo2()
UPDATE 我發現在論壇的功能和它的工作,但我不能停止動畫或做別的。
import time
repeat_time = 0.3
while True:
start_time = time.time()
self.nextitem()
time.sleep(max(repeat_time - (time.time() - start_time), 0.0))
感謝您的信息;我會搜索一下 – seghier
謝謝;我找到一個很好的例子:http://nullege.com/codes/show/[email protected]@[email protected]@[email protected]@[email protected]@bubbleswidget.py/126/PyQt5.QtCore.QTimer – seghier