python-3.x - PyQt5 中的 QWebSettings(版本 5.6.0)

标签 python-3.x pyqt pyqt5 conda qtwebkit

我有PyQt5 (版本 5.6.0)通过 Anaconda 安装在我的 Mac (OS X 10.12.2) 上。现在我想重新使用使用 QtWebKitWidgets 的旧脚本和QtWebKit不过,这两个包好像已经在 PyQt5.6.0 中被删除了。我已经知道QtWebKitWidgets已替换为 QtWebEngineWidgets (这一切对我来说都很好),但是在我的旧代码中,我正在导入 QWebSettings来自QtWebKit ,即

from PyQt5.QtWebKit import QWebSettings

但我在这里没有收到导入错误:

ImportError: cannot import name 'QtWebKit'

根据PyQt documentation ,

QtWebEngineWidgets contains classes for a Chromium based implementation of a web browser. This supercedes the QtWebKit module and provides better and up-to-date support for HTML, CSS and JavaScript features. However it also consumes more resources and doesn’t give direct access to the network stack and the HTML document via Python APIs.

但是我在哪里可以找到QWebSettings ?谁能告诉我在哪里可以找到QWebSettings现在,或者我如何添加包 QtWebKit

任何帮助将不胜感激。

最佳答案

正确的导入语句是:

从 PyQt5.QtWebEngineWidgets 导入 QWebEngineSettings

关于python-3.x - PyQt5 中的 QWebSettings(版本 5.6.0),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41751692/

相关文章:

python - 使用 python win32com Outlook 清楚地记录阅读电子邮件功能

python - 为什么 mouseMoveEvent 在 PyQt5 中什么都不做

python - QDoubleSpinBox “backspace”键的编辑行为

python-3.x - 为什么 pyqtSlot 装饰器会导致 "TypeError: connect() failed"?

python - 在 PyQt 的第二个线程中打开子对话框的正确方法是什么?

python - 单击 QPushButton 时,它会触发两次

python-3.x - IDLE 3.8.4 和 3.9.0b4 不会保存非 ascii 字符的文件

mysql - 使用带有 'multi=True' 参数的execute() 函数创建时出现“表不存在”

python - 使用单独的 python 函数导入依赖项

python - 为什么 super 在 PySide/PyQt 中用得那么多?