PyQt Browser阻止代码执行

时间:2017-10-27 19:44:18

标签: python browser pyqt pyqt5

我已将PyQt5浏览器添加到我的项目中,但是当执行show()方法时,它会阻止跟随它的代码。有没有办法,不是将其显示为模态,还是让它在另一个线程上运行?

这是我从Python Tutorials网站获取的代码,它完美无缺,但只是阻止show()上的代码:

import sys
from PyQt5 import QtCore, QtGui, QtWidgets
from PyQt5.QtCore import *
from PyQt5.QtGui import *
from PyQt5.QtWidgets import *
from PyQt5.QtWebKit import *
from PyQt5.QtWebKitWidgets import *
from PyQt5.QtWidgets import QApplication, QWidget, QMainWindow

app = QApplication(sys.argv)

web = QWebView()
web.load(QUrl("https://pythonspot.com"))
web.show() 
# the code in here won't run while the form web.show() opened, is not closed
sys.exit(app.exec_()) 

0 个答案:

没有答案