小编Jos*_*her的帖子

回调函数中的AttributeError

我真的很抱歉用一个AttributeError来打扰你,但我无法弄清楚我的代码有什么问题,尽管我已经解决了很多关于AttributeErrors的问题.

这是我的代码:

class Base:

    def __init__(self):
        self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
        self.window.set_position(gtk.WIN_POS_CENTER)
        self.window.set_size_request(500,500*9/16)
        self.window.set_title("pattern_executer")

        self.button1 = gtk.Button(" E x i t ")
        self.button1.connect("clicked",self.close)

        self.button2 = gtk.Button("Plot")
        self.button2.connect("clicked",self.plot)

        self.button3 = gtk.Button("Search")
        self.button3.connect("clicked",self.search)

        self.entry1 = gtk.Entry()
        self.entry1.connect("changed",self.dir_ch)
        self.entry1.set_text("dir1")

        self.entry2 = gtk.Entry()
        self.entry2.connect("changed",self.dir_ch)
        self.entry2.set_text("name")

        self.entry3 = gtk.Entry()
        self.entry3.connect("changed",self.dir_ch)
        self.entry3.set_text("dir2")

        #self.label1 = gtk.Label("FUNCTIONS")

        fixed1 = gtk.Fixed()
        fixed1.put(self.button1,10,250)
        fixed1.put(self.button2,10,60)
        fixed1.put(self.button3,10,30)
        fixed1.put(self.entry1,90,30)
        fixed1.put(self.entry2,90,60)
        fixed1.put(self.entry3,90,90)


        self.window.add(fixed1)
        self.window.show_all()
        self.window.connect("destroy",self.close)

    def run(self,widget):

        print "Run ... "


    def search(self,widget):
        box = (settings[1] - settings[3]/2,settings[2] - settings[4]/2,settings[1] + settings[3]/2,settings[2] + settings[4]/2)
        cut1 = …
Run Code Online (Sandbox Code Playgroud)

python gtk pygtk attributeerror

5
推荐指数
1
解决办法
759
查看次数

标签 统计

attributeerror ×1

gtk ×1

pygtk ×1

python ×1