Пример #1
0
def main(**kwargs):
    playerParam = 'contestants'
    kwargs['round'] = "1"
    g_question, g_answers = GetQuestionAndAnswers(**kwargs)
    if playerParam in kwargs and kwargs[playerParam] is not None:
        g_contestants = kwargs[playerParam]
    else:
        g_contestants = ['Family 1', 'Family 2']
    print('Prompt: ' + g_question)
    print('Responses: ' + str(g_answers))
    print('Players: ' + str(g_contestants))

    # Offset table to avoid magic numbers
    offsets = DotMap()
    # x offsets ( 0 == L, (max) == R)
    offsets.DisplayCount = 0
    offsets.DisplayAnswer = 1
    offsets.PlayerStart = 2
    offsets.PlayerEnd = offsets.PlayerStart + len(g_contestants) - 1
    offsets.SubmitButton = offsets.PlayerEnd + 1
    # y offsets (0 == Top, (max) == bototm)
    offsets.Question = 0
    offsets.Names = offsets.Question + 1
    offsets.AnswerBegin = offsets.Names + 1
    offsets.AnswerEnd = offsets.AnswerBegin + len(g_answers) - 1
    offsets.PlayerScore = offsets.AnswerEnd + 1
    offsets.RoundMultiplier = offsets.PlayerScore

    master = tk.Tk()
    PopulateWindow(master=master,
                   offsets=offsets,
                   question=g_question,
                   answers=g_answers,
                   contestants=g_contestants,
                   round=kwargs['round'])
    tk.mainloop()