def run(self, window): self.window = window frame = self.view(window, back_button=True) vbox = gui.Box(frame, axis=1, expand=True) self.question_text = tichy.Text("Question") self.question_text.view(vbox, expand=True, font_size=58) self.choices = tichy.List() self.choices.view(vbox, expand=True) frame.connect('back', self.on_quit) dic = codecs.open(Learn.path('characters.dic'), encoding='utf-8') logger.info("opening the dict") # dic = open(Learn.path('characters.dic'), 'r') dic = Dic.read(dic) self.full_dic = dic[:] brain = Brain() logger.info("start game") self.task = None while True: self.task = brain.ask(self.ask, dic) try: yield self.task except GeneratorExit: break