recipe-577527.py 文件源码

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

项目:code 作者: ActiveState 项目源码 文件源码
def body(self, master):
        title = font.Font(self, size=TITLE_SIZE)
        legend = font.Font(self, weight='bold')
        # Create display variables.
        self.category = StringVar(master)
        self.question = StringVar(master)
        self.answer = StringVar(master)
        self.right = StringVar(master)
        # Create form labels.
        self.c_label = Label(master, textvariable=self.category, font=title)
        self.q_label = Label(master, textvariable=self.question)
        self.you_answered = Label(master, text='You answered:', font=legend)
        self.a_label = Label(master, textvariable=self.answer)
        self.right_answer = Label(master, text='Right answer:', font=legend)
        self.r_label = Label(master, textvariable=self.right)
        # Create control buttons.
        options = {'text': '< < <',
                   'width': TEXT_WIDTH // 2,
                   'command': self.go_back}
        self.back = Button(master, **options)
        options = {'text': '> > >',
                   'width': TEXT_WIDTH // 2,
                   'command': self.go_next}
        self.next = Button(master, **options)
        # Display the body.
        options = {'sticky': NSEW, 'padx': 5, 'pady': 5}
        self.c_label.grid(row=0, column=0, columnspan=2, **options)
        self.q_label.grid(row=1, column=0, columnspan=2, **options)
        self.you_answered.grid(row=2, column=0, **options)
        self.a_label.grid(row=2, column=1, **options)
        self.right_answer.grid(row=3, column=0, **options)
        self.r_label.grid(row=3, column=1, **options)
        self.back.grid(row=4, column=0, **options)
        self.next.grid(row=4, column=1, **options)
        # Update the labels.
        self.update()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号