Created
April 3, 2015 05:40
-
-
Save petfactory/4433fc65b4b4de16219d to your computer and use it in GitHub Desktop.
Load a web view
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from PySide import QtCore, QtGui, QtWebKit | |
class MyWidget(QtGui.QDialog): | |
def __init__(self, parent, url): | |
super(MyWidget, self).__init__(parent) | |
# set window stuff | |
self.setWindowTitle('Hello Tree Widget') | |
self.setWindowFlags(QtCore.Qt.Tool) # without this the win will not stay ontop | |
# layout | |
main_layout = QtGui.QVBoxLayout() | |
main_layout.setContentsMargins(0,0,0,0) | |
self.setLayout(main_layout) | |
self.web_view = QtWebKit.QWebView() | |
main_layout.addWidget(self.web_view) | |
self.web_view.setUrl(QtCore.QUrl(url)) | |
self.web_view.show() | |
def closeEvent(self, event): | |
print('stop the video') | |
#self.web_view.setUrl(QtCore.QUrl("")) | |
#self.web_view.stop() | |
f = MyWidget(QtGui.QApplication.activeWindow(), "https://vimeo.com/81086775") | |
f.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment