Webkit resizes the window it is in to render the full page. The problem though is that it doesn't resize down by default, so if it sized up initially, and you load a second page which is shorter, the page gets tiled. Is there a way to resize it back down to fit the page?
import gtk
import webkit
window = gtk.Window()
browser = webkit.WebView()
window.add(browser)
browser.open('http://www.amazon.com')
window.show_all()
Now the window is resized to fit the whole page, but if 开发者_开发知识库I then do:
browser.open('http://www.google.ca')
The window size is still at the dimensions that it was when the amazon page was loaded. The only thing I've been able to do is to remove the old webkit object and create a new webkit.webView() object but that seems very cludgey.
Put your web view in a gtk.ScrolledWindow
. Then it won't resize to fit the whole page.
精彩评论