def code_block(code, strip_indent=4):
    if strip_indent:
        lines = ((i[strip_indent:] if (i[:strip_indent] == (' ' * strip_indent)) else i) for i in code.splitlines())
        code = '\n'.join(lines)
    code = code.strip('\n')

    def run_code(code, scope):
        with use_scope(scope):
            exec(code, globals())
    with use_scope() as scope:
        put_code(code, 'python')
        put_buttons([{'label': t('Run', '运行'), 'value': '', 'color': 'success'}], onclick=[partial(run_code, code=code, scope=scope)], small=True)
def code_block(code, strip_indent=4):
    if strip_indent:
        lines = ((i[strip_indent:] if (i[:strip_indent] == (' ' * strip_indent)) else i) for i in code.splitlines())
        code = '\n'.join(lines)
    code = code.strip('\n')

    def run_code(code, scope):
        with use_scope(scope):
            exec(code, globals())
    with use_scope() as scope:
        put_code(code, 'python')
        put_buttons([{'label': t('Run', '运行'), 'value': , 'color': 'success'}], onclick=[partial(run_code, code=code, scope=scope)], small=True)