LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 1502|回复: 0

pygtkembed 程序跑不起来!

[复制链接]
发表于 2008-8-11 21:30:20 | 显示全部楼层 |阅读模式
程序运行后,直接退出了,没有任何错误提示
已经安装的包:[PHP]pygtk2-2.12.0-2.fc8
gnome-python2-gtkmozembed-2.19.1-16.fc8[/PHP]

程序:
[PHP]#!/usr/bin/env python
import gtk
import gtkmozembed
def CloseWindow(caller_widget):
     """Close the window and exit the app"""
     gtk.main_quit() # Close the app fully

# Set-up the main window which we're going to embed the widget into
win = gtk.Window() # Create a new GTK window called 'win'

win.set_title("Simple Web Browser") # Set the title of the window
win.set_icon_from_file('/usr/share/icons/Fedora/24x24/apps/openofficeorg-base.png') # Set the window icon to a web browser icon
win.set_position(gtk.WIN_POS_CENTER) # Position the window in the centre of the screen

win.connect("destroy", CloseWindow) # Connect the 'destroy' event to the 'CloseWindow' function,
                                                                #so that the app will quit properly when we press the close button

# Create the browser widget
gtkmozembed.set_profile_path("/tmp", "simple_browser_user") # Set a temporary Mozilla profile (works around some bug)
mozbrowser = gtkmozembed.MozEmbed() # Create the browser widget

# Set-up the browser widget before we display it
win.add(mozbrowser) # Add the 'mozbrowser' widget to the main window 'win'
mozbrowser.load_url("http://www.ubuntu.com") # Load a web page
mozbrowser.set_size_request(600,400) # Attempt to set the size of the browser widget to 600x400 pixels
mozbrowser.show() #Try to show the browser widget before we show the window,
                                #so that the window appears at the correct size (600x400)

win.show() # Show the window
gtk.main() # Enter the 'GTK mainloop', so that the GTK app starts to run[/PHP]
您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表