main.py 文件源码

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

项目:Sorting-Hat 作者: WillSkywalker 项目源码 文件源码
def update(self):
        self.button.destroy()
        question = self.hat.ask_question()
        if question is None:
            self.result()
            return
        self.label.destroy()
        self.label = tk.Label(text=question['question'], bg='black', fg='white')
        self.label.grid(row=1, column=1)
        self.sublabel.destroy()
        self.sublabel = tk.Label(text='\n'.join(question['answers']), 
                                 bg='black', fg='white')
        self.sublabel.grid(row=2, column=1)
        for button in self.buttons:
            button.destroy()
        for i in range(len(question['answers'])):
            button = tk.Button(self.button_frame, text=ascii_uppercase[i], highlightbackground='black', 
                               command=partial(self.choose_answer, answer=ascii_uppercase[i]))
            button.grid(row=0, column=i)
            self.buttons.append(button)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号