求教!GTK not available是怎么回事?
各位大神,我是GTK新手,想在linux完成GUI的制作。现在遇到了问题:GTK not available,不知道怎么解决,无法继续,向各位求教了。
下面是我的环境:
1.Linux系统 unbantu 10.04
2.glade3
3.GTK环境(如若看不清,请查看附件):
4.python3.4.3
5.python程序如下(附件):
#!/usr/bin/env python
try:
import pygtk
pygtk.require('2.0')
except:
pass
try:
import gtk
import gtkglade
except:
print('GTK not available')
sys.exit(1)
class Buglump:
def on_window1_destroy(self, object, data=None):
print "quit with cancel"
gtk.main_quit()
def on_gtk_quit_activate(self, menuitem, data=None):
print "quit from menu"
gtk.main_quit()
def on_gtk_about_activate(self,object,data=None):
print "help about selected"
self.response=self.aboutdialog.run()
self.aboutdialog.hide()
def on_push_status_activate(self,menuitem,data=None):
self.status_count+=1
self.status(self.context_id,"Messagenumber %s" % str(self.status_count))
def on_pop_status_activate(self,menuitem,data=None):
self.status_count-=1
self.statusbar.pop(self.context_id)
def on_clear_status_activate(self,menuitem,data=None):
while (status_count>0):
self.statusbar.pop(self.context_id)
self.status_count-=1
def __init__(self):
self.gladefile = "tutorial-1.glade"
self.builder = gtk.Builder()
self.builder.add_from_file(self.gladefile)
self.builder.connect_signals(self)
self.window = self.builder.get_object("window1")
self.aboutdialog=self.builder.get_object("aboutdialog1")
self.context_id=self.statusbar.get_context_id("status")
self.status_count=0
self.window.show()
if __name__ == "__main__":
main = Buglump()
gtk.main()
当我一运行时就会出现“GTK not available”,还请大侠不吝赐教,非常感谢
页:
[1]