本文整理汇总了Python中question.Question.next方法的典型用法代码示例。如果您正苦于以下问题:Python Question.next方法的具体用法?Python Question.next怎么用?Python Question.next使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类question.Question
的用法示例。
在下文中一共展示了Question.next方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from question import Question [as 别名]
# 或者: from question.Question import next [as 别名]
#.........这里部分代码省略.........
play_button = Button(
'Play',
self.lg_font,
Color.BLACK,
200,
100,
Color.WHITE,
Color.BLACK,
-2
)
menu_label = self.xlg_font.render('MATH HURDLER', 1, Color.BLACK)
gameover_label = self.xlg_font.render('GAME OVER', 1, Color.BLACK)
pygame.mixer.music.load(self.songs[0])
pygame.mixer.music.play(-1)
def reset():
question_dirty = True
self.points = 0
self.hurdle_number = 0
self.x = -100
self.vx = 0
self.direction = -1
horse.set_horse(Horse.BASE)
set_answer(-1)
def generate_question():
self.question.next()
self.buttons[0].set_text(str(self.question.choices[0]))
self.buttons[1].set_text(str(self.question.choices[1]))
self.buttons[2].set_text(str(self.question.choices[2]))
self.buttons[3].set_text(str(self.question.choices[3]))
self.buttons[0].set_color(self.buttons[0].color, False)
self.buttons[1].set_color(self.buttons[0].color, False)
self.buttons[2].set_color(self.buttons[0].color, False)
self.buttons[3].set_color(self.buttons[0].color, False)
self.question_text_label = self.lg_font.render(str(self.question), 1, Color.BLACK)
self.hurdle_number += 1
self.score_label = self.lg_font.render(str(self.points),1,Color.BLACK)
self.question_label = self.font.render("Hurdle #" + str(self.hurdle_number), 1, Color.BLACK)
question_board.fill(Color.WHITE)
self.score_label = self.lg_font.render(str(self.points), 1, Color.BLACK)
def set_answer(answer_index):
#unselect the previous answer button
if self.last_answer_index >= 0:
self.buttons[self.last_answer_index].set_selected(False)
if answer_index >= 0:
self.last_answer = Fraction(self.buttons[answer_index].text)
self.buttons[answer_index].set_selected(True)
self.last_answer_index = answer_index
else:
self.last_answer = -1
self.last_answer_index = -1