def update(): movetolower() currentGen = utils.prettyPrint(generation.get(), generation.getScores()) content.append(urwid.Text(currentGen)) updateHeaders()
def newGeneration(): generation.init() print utils.prettyPrint(generation.get(), generation.getScores()) genMenu()
] text_controls = [ ('key', ' J'), ('controls', ' - Next Generation\n'), ('key', ' R'), ('controls', ' - Start Over\n'), '\n', ('key', ' M'), ('controls', ' - MIDI Output\n'), ('key', ' E'), ('controls', ' - DNA Export\n'), '\n', ('key', ' Q'), ('controls', ' - Quit') ] midifocus = False dnafocus = False generation.init() currentGen = utils.prettyPrint(generation.get(), generation.getScores()) prevGen = "" def updateHeaders(): current = generation.getAge() if current == 0: prev = 0 else: prev = current-1 leftheader.set_text([('title', 'Current Generation'), ('title', ' (' + str(current) + ')')]) leftheader2.set_text([('title', 'Previous Generation'), ('title', ' (' + str(prev) + ')')]) content = [urwid.Text(currentGen)] leftheader = urwid.Text('') leftc = urwid.ListBox(content) edit = urwid.Edit()