为什么这个wxPython脚本给出了Gtk-WARNING

时间:2013-06-08 12:27:46

标签: user-interface wxpython gtk2

操作系统:Ubuntu 12.1,python:2.7.3,wx:2.8 gtk2

#!/usr/bin/env python
#-*- coding:utf-8 -*-

import wx
import sys

class Frame (wx.Frame):

    def __init__(self, parent, id, title):
        print "Frame Initialised"
        wx.Frame.__init__(self, parent, id, title)

class App (wx.App):

    def __init__ (self, redirect=True, filename=None):
        print "Application Initialised"
        wx.App.__init__(self, redirect, filename)

    def OnInit (self):
        print "This is Application"
        self.frame = Frame (parent=None, id=-1, title="Startup")
        self.frame.show ()
        self.SetTopWindow (self.frame)
        print >> sys.stderr, "A fake error message"
        return True

    def OnExit (self):
        print "Application Exiting"

if __name__ == '__main__':
    app = App (redirect=True)
    print "Things Before"
    app.MainLoop ()
    print "Things After"

错误:

(python:3805): Gtk-WARNING **: Unable to locate theme engine in module_path: "pixmap"

此错误重复3次,但不提供输出。脚本有什么问题吗?谢谢你的帮助。

我通过安装pixbuf来修复警告:

sudo apt-get install gtk2-engines-pixbuf

现在出现了一个新问题;框架只是闪烁并迅速消失。我无法阅读任何重定向的消息!

1 个答案:

答案 0 :(得分:0)

self.frame.show()

应该是

self.frame.Show ()

首都'