需要一个简单的“Hello World"在 Python 中使用 Webkit 库的示例 [英] Need a simple "Hello World" example using the Webkit library in Python

查看:35
本文介绍了需要一个简单的“Hello World"在 Python 中使用 Webkit 库的示例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有谁知道在 Python 中使用 Webkit 库的简单Hello World"示例?我有一个 GTK 窗口,我想在里面放 Webkit.

Does anyone know of a simple "Hello World" example for using the Webkit library in Python? I have a GTK window, and inside I want to put Webkit.

使用 Python/mozembed (Mozilla/Gecko),这很简单:

With Python/mozembed (Mozilla/Gecko), this is simple:

mozembed = gtkmozembed.MozEmbed()
mozembed.load_url('http://google.com/')

..而且我已经创建了我的浏览器,我该如何使用 WebKit 来做到这一点?

..and I have already created my browser, how do I do this with WebKit?

推荐答案

您是否检查了 Python 绑定WebKit GTK+ 端口.在其中一个目录中有关于如何使用它的演示,包括浏览器:python demos/tabbed_browser.py

Did you check the Python bindings for the WebKit GTK+ port. In one of the directory there are demos on how to use it, including a browser: python demos/tabbed_browser.py

您还可以在 WebKit GTK+ (pdf) 开发混合 Web/GTK+ 富互联网应用程序.

You could check also the slides of a FOSDEM by Alp Toker on WebKit GTK+ (pdf) Developing hybrid Web/GTK+ rich internet applications.

import gtk 
import webkit 

view = webkit.WebView() 

sw = gtk.ScrolledWindow() 
sw.add(view) 

win = gtk.Window(gtk.WINDOW_TOPLEVEL) 
win.add(sw) 
win.show_all() 

view.open("http://w3.org/") 
gtk.main()

这应该会给你很好的开始提示.

That should give you good hints for starting.

这篇关于需要一个简单的“Hello World"在 Python 中使用 Webkit 库的示例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆