Show fullscreen webpage in 5 seconds then close window (python)
<p>I want to make a python script that opens up a local html file in browser and after 5 seconds close that window.</p>

<p>I've tried the self.close() method and if I add "time.sleep()" it will only delay the display of the web content</p>

<p>Here's my code (I'm a newbie so, sorry for that)</p>

<pre><code>import sys
from PyQt4.QtCore import *
from PyQt4.QtGui import *
from PyQt4.QtWebKit import *
import urllib
import time


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)
        time.sleep(dur)
        self.close()


def main(url, dur):
    app = QApplication(sys.argv)
    window = Window(url, dur)
    window.showFullScreen()
    app.exec_()

main('test.html', 5)
</code></pre>

<p>Any suggestions? As you can see I want to pass both url and duration (sleep) in the constructor.</p>