0
我想在Python中做一個簡單的幻燈片來查看0.html,1.html和2.html與他們之間3秒的延遲。幻燈片的網頁(python)
下面的腳本顯示0.html在3秒內,然後我得到一個「分段錯誤(核心轉儲)」的錯誤。有任何想法嗎?
我迄今爲止代碼:
#!/usr/bin/python
import sys
from PyQt4.QtCore import *
from PyQt4.QtGui import *
from PyQt4.QtWebKit import *
import urllib
class Window(QWidget):
def __init__(self, url, dur):
super(Window, self).__init__()
view = QWebView(self)
layout = QVBoxLayout(self)
layout.setContentsMargins(0, 0, 0, 0)
layout.addWidget(view)
html = urllib.urlopen(url).read()
view.setHtml(html)
QTimer.singleShot(dur * 1000, self.close)
def playWidget(url, dur):
app = QApplication(sys.argv)
window = Window(url, dur)
window.showFullScreen()
app.exec_()
x = 0
while (x < 3):
page = "%s.html" % x
playWidget(page , 3)
x = x + 1