specialwidgets.py 文件源码

python
阅读 28 收藏 0 点赞 0 评论 0

项目:Solfege 作者: RannyeriDev 项目源码 文件源码
def add(self, question, callback):
        """add a button and set up callback function.
        there should not be created more than one button with the same
        (c locale) name.
        return the button created.
        """
        if 'newline' in question and question.newline:
            self.newline()
        b = Gtk.Button()

        if question.name.cval in self.m_button_dict:
            print >> sys.stderr, "Warning: The lessonfile contain several questions with the same name:", question.name.cval
            print >> sys.stderr, "         This is a bug in the lesson file."
        self.m_button_dict[question.name.cval] = b
        self.m_name_list.append(question.name.cval)
        b.m_cname = question.name.cval
        b.set_sensitive(question.active)
        b.add(lessonfilegui.new_labelobject(question.name))
        b.show_all()
        self.attach(b, self.m_x, self.m_x+1, self.m_y, self.m_y+1)
        b.connect('clicked', callback)
        b.connect('button_release_event', callback)
        self.conditional_newline()
        return b
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号