import pycurl
from StringIO import StringIO
import gtk
import webkit
wd = gtk.Window()
wd.set_title("example browser")
storage = StringIO()
c=pycurl.Curl()
c.setopt(pycurl.ENCODING,"")
c.setopt(pycurl.FOLLOWLOCATION,1)
c.setopt(pycurl.AUTOREFERER,1)
c.setopt(pycurl.HEADER,1)
c.setopt(pycurl.MAXREDIRS,5)
c.setopt(pycurl.FAILONERROR,1)
c.setopt(pycurl.URL,"http://whatsmyua.com")
c.setopt(pycurl.WRITEFUNCTION, storage.write)
c.perform()
c.close()
html1 = storage.getvalue()
htm = webkit.WebView()
htm.load_string("<p>example page</p><br>" , "text/html" , "utf-8" , html1)
wd.add(htm)
wd.show_all()
gtk.main()
上面的代码下载页面,然后显示一个仅包含“示例页面”字符串而没有其他内容的窗口。所以我该怎么做 。请帮忙......