Skip to content

Conversation

@AngelaRemolina
Copy link
Owner

@AngelaRemolina AngelaRemolina commented Jun 13, 2021

This PR resolves #2
A Brython module is now created, and you can write something like this:

.. activecode::
    :language: python3
    :python3_interpreter: brython

    print("You can see this print on the browser console")

    from browser import document, alert, html

    def hello(ev):
        alert("Hello! I'm using Brython :D")

    document <= html.BUTTON("My button", id="button_alert")
    document["button_alert"].bind("click", hello)

And this will be the output:

Brython module achieved

This test will also close #3

One thing to have in mind is that by now this module cannot print in console with the print() command. Those prints will show in the browser console. You can only show things using the document and html module as is shown in the image, because the output is an <iframe> with an attribute srcdoc that shows like a mini html page running with Brython.

@AngelaRemolina AngelaRemolina changed the title Work-in-progress python3_interpreter activecode directive Python3_interpreter activecode directive Jun 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add test to the new activecode directive Add brython as an activecode directive

2 participants