从 pyqt 的 qwebkit 下载文件 [英] download file from qwebkit at pyqt
本文介绍了从 pyqt 的 qwebkit 下载文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
全部.我使用 qwebkit pyqt4 来实现浏览器.我有一个简单的代码来呈现页面.我可以在网站上冲浪,但我不能从中下载任何东西.
all. I use qwebkit pyqt4 for implementation of the browser. I have a trivial code to render the page. I can surf the web sites, but i can't download anything from it.
#!/usr/bin/env python
import os, sys, urllib.request
from PyQt4.QtCore import *
from PyQt4.QtGui import *
from PyQt4.QtWebKit import *
if __name__ == '__main__':
login_url = "http://google.com"
app = QApplication(sys.argv)
view = QWebView()
frame = view.page().mainFrame()
view.load(QUrl(login_url))
view.show()
app.exec_()
需要什么来补充可以从链接下载文件的代码?
What is needed to supplement the code that you could download files from links?
推荐答案
将处理程序连接到 downloadRequested 网络视图 page,然后使用页面的networkAccessManager 处理请求.
Connect a handler to the downloadRequested signal of the webview's page, and then use the page's networkAccessManager to process the request.
这篇关于从 pyqt 的 qwebkit 下载文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文