On Friday 02 July 2010 3:04:40 am you wrote: > On Fri, 02 Jul 2010 00:31:40 -0500, alan moore <m...@alandmoore.com> wrote: > >> 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. > > No, the load starts straight away but may not finish until some time later > (probably after the method returns). > > The view will update itself when it has enough of the page loaded to be > usefully displayed. > > The display won't actually change until the even loop runs. >
Thanks for the response. From my experimenting with this, apparently the history doesn't update until after the display does. I tried something like this: def reset_browser(self): self.webview.load(self.homepage) while self.webview.history().currentItem().url() != self.homepage: pass self.webview.history().clear() With the idea being that I'd wait until the history had changed to clear it, but it never changed. The while loop went on infinitely. > > To illustrate the problem I'm having a little more clearly, I've > > attached a sample script. The script is supposed to conduct a brief > > tour of a list of websites when you hit the "go" button on the browser > > toolbar. Each site shows for five seconds, then the next on loads. > > > > Only that's not what happens. If you run it, you'll see that hitting > > "go" causes the browser to hang for about 20 seconds, then the final > > comment is all that shows. In other words, for the whole duration of > > the method call, the main window is asleep. > > > > I guess this is just another instance of the trouble I was running into > > on my other program, which I posted a demonstration script for earlier > > today. I would really appreciate any help on this matter. > > You need to get rid of your loop and sleep() and connect to the > QWebView.loadFinished() signal. In the connected slot start a timer for 5 > seconds. When that timer times out you can then set the next URL. > > Phil I can see how that works for this example. In the case of my original program, I'm not so sure. I can't connect webview.history().clear() to loadFinished(), or else every single page load will clear the history. And I can't connect and disconnect in the same callback, because it won't be processed until the callback exits. Thanks again for your help. _______________________________________________ PyQt mailing list PyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt