dliv
dliv

Reputation: 685

QWebSettings in PyQt5 (version 5.6.0)

I have PyQt5 (version 5.6.0) installed via Anaconda on my Mac (OS X 10.12.2). Now I would like to re-use an older script that used QtWebKitWidgetsand QtWebKit, however, these two packages seem to have been removed in PyQt5.6.0. I already know that QtWebKitWidgets was replaced by QtWebEngineWidgets (which all works fine for me), but in my old code, I was importing QWebSettings from QtWebKit, i.e.

from PyQt5.QtWebKit import QWebSettings

But not I get an ImportError here:

ImportError: cannot import name 'QtWebKit'

According to the 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.

But where do I find QWebSettings? Can anyone please tell me where I can find QWebSettingsnow, or how I can add the package QtWebKit?

Any help would be very much appreciated.

Upvotes: 3

Views: 2282

Answers (1)

trinkner
trinkner

Reputation: 384

The correct import statement is:

from PyQt5.QtWebEngineWidgets import QWebEngineSettings

Upvotes: 1

Related Questions