【发布时间】:2014-06-09 11:24:26
【问题描述】:
这是我的示例代码。如何获取当前页面的html源代码。它只打印 'GString at 0x8875130' 。如何将其转换为包含html的真实文本?
from gi.repository import WebKit
from gi.repository import Gtk, Gdk
def get_source(webobj, frame):
print "loading..."
x = web.get_main_frame().get_data_source().get_data()
print x
win = Gtk.Window()
web = WebKit.WebView()
web.open("http://google.com")
web.connect("load-finished", get_source)
win.add(web)
win.show_all()
Gtk.main()
【问题讨论】:
标签: python html webkit pygtk gtk3