[PyQt] QWebkit / QWebFrame
Andreas Pakulat
apaku at gmx.de
Tue Jan 10 08:10:29 GMT 2012
On 09.01.12 16:30:43, James Polk wrote:
> Howdy,
>
> I believe Guru Hans-Peter ;-) posted a collection of PyQt examples that
> he converted into Python from the Qt C++ examples..
>
> In one titled "fancybrowser.py"
>
>
> There's a few lines that read...
>
>
> @QtCore.pyqtSlot()
> def submit(self):
> frame = self.ui.webView.page().mainFrame()
>
> then
>
>
> firstName = frame.findFirstElement("#firstname")
>
>
> It appears that the function "findFirstElement()" appeared in a version of Qt
> that came along after the one I'm on (4.5.3)
>
> 1) Can anyone suggest a code workaround that would accomplish same
>
> that will work in 4.5.3 rather than 4.7 or 4.8 (whenever that appeared)
The function was added in 4.6 along with the rest of the API to access
the webpage elements. There's no way to access the DOM tree with older
Qt versions, except loading the website into QDom (provided its
complying with the XML standard) or loading it into another Webkit-based
browser that does allow to access the DOM Api in whatever version you
have available.
> 2) Secondly,...as an alternative, one that I hesitate to try,...is it possible for two
> versions of Qt (and I guess two versions of PyQt and Sip) to exist simultaneously?
> Using one version for *this* and another version for *that* ?
Not in the same application. You'll probably need something like
virtualenv to properly separate both PyQt/sip installations and it
probably also won't work with a system-installed PyQt/sip on Linux (i.e.
distribution packages).
Andreas
More information about the PyQt
mailing list