示例#1
0
文件: web_raven.py 项目: jperla/raven
def template_answered_matrix(p, matrix_id, f, answer, guessed):
    with p(html.html()):
        with p(html.head()):
            p(html.title('Answered a matrix'))
    with p(html.body()):
        if answer == guessed:
            p(html.h1('Correct!'))
        else:
            p(html.h1('Sorry, wrong answer :('))
        p(html.h2('You guessed: '))
        p(html.p(html.img(figure_image.url(guessed))))
        p(html.p(html.a(ask_matrix.url(matrix_id), 'Back to this matrix')))
        p(html.p(html.a(generate_random_matrix.url(), 'or Generate a new matrix')))
        p(html.p(html.img(matrix_guess.url(matrix_id))))
示例#2
0
文件: web_raven.py 项目: jperla/raven
def template_ask_matrix(p, id, figure, answer, choices):
    with p(html.html()):
        with p(html.head()):
            p(html.title('Answer a matrix'))
    with p(html.body()):
        p(html.p(html.img(matrix_guess.url(id))))
        choice_html = [helper_choice(figure, c) 
                        for c in choices] + [helper_choice(figure, answer)]
        numpy.random.shuffle(choice_html)
        with p(html.form()):
            for c in choice_html:
                p.sub(c)
            p(html.input_submit(value='Answer'))