E
E
ertaquo2011-08-21 09:39:47
Python
ertaquo, 2011-08-21 09:39:47

Path to image loaded in QWebView?

There is QWebView in which the page is loaded. There is a picture on the page with which you need to perform some actions in the program (Python 3, PyQT4). Accordingly, you need to get the path to this image on the disk. Can this be done somehow?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
ertaquo, 2011-08-21
@ertaquo

Not exactly as it should be, but seems to have solved the problem:

self.view = QtWebKit.QWebView(self)

cache = QtNetwork.QNetworkDiskCache()
cache.setCacheDirectory(QtCore.QDir.currentPath() + QtCore.QDir.separator() + "cache")

self.view.page().networkAccessManager().setCache(cache)

......

self.view.page().networkAccessManager().cache().data(\
  QtCore.QUrl(self.view.page().mainFrame().documentElement().findAll("#image")[0].attribute("src")) \
) # и далее работа с файлом

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question