[PyQt] Synchronous WebView.load()
alanm
me at alandmoore.com
Thu Jul 1 21:05:15 BST 2010
On Thursday 01 July 2010 2:13:47 pm alanm wrote:
> I have an app with a QWebView, and I'm trying to implement a "reset" button
> that will clear the history and return the user to the start page.
>
> The method looks like this:
>
> def reset_browser(self):
> self.webview.load(self.startUrl)
> self.webview.history().clear()
>
After some experimenting, it turns out that the problem isn't quite what I
thought it was. In fact, it's almost the opposite problem.
I put self.webview.load() in a while loop so that it would continue to load
while the history.currentItem().url() is not equal to the startUrl(). The
loop turned out to be infinite.
As I understand it, the webview doesn't actually load the page and update
itself until the method call returns; at which point it loads the new page and
updates the history.
It seems like there's no way to do what I want in one function then, is there?
More information about the PyQt
mailing list