--
You received this message because you are subscribed to the Google Groups "brython" group.
To unsubscribe from this group and stop receiving emails from it, send an email to brython+u...@googlegroups.com.
To post to this group, send email to bry...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/brython/CAB-sx63xMK8gPQDT22RYrH8fQR%2BS325oeQjbSQd6qDfw3--pyA%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.
eval(__BRYTHON__.py2js(_str).tojs())_str+=" doc['mydiv'] <= html.P(i, style={'backgroundColor': 'cyan'})\n"_str+="for i in range(5):\n"_str="from browser import doc, html\n"Kiko,I have not tried this, but it seems to me you could just put it all in a variable such as
--
You received this message because you are subscribed to the Google Groups "brython" group.
To unsubscribe from this group and stop receiving emails from it, send an email to brython+u...@googlegroups.com.
To post to this group, send email to bry...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/brython/CAB-sx60Lx%3Dq7ObBk92LVZGpckMsrVXf6eoZu2%3DLTZ-3UWp_HhA%40mail.gmail.com.
BillyThis brings up a good point.if brython is added to a page via a script tag, should brython automatically set the window.onload to brython()? Or should we force the user to type <body onload="brython()"> ? Does typing <body onload="brython()"> override/reset window.onload?
--
You received this message because you are subscribed to the Google Groups "brython" group.
To unsubscribe from this group and stop receiving emails from it, send an email to brython+u...@googlegroups.com.
To post to this group, send email to bry...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/brython/47b87e80-5cc4-496e-a6cc-288f024310bb%40googlegroups.com.
<script>
function run_python(src){
// dynamically create an invisible DIV with type="text/python3"
var py_script = document.createElement('div')
py_script.style.visibility = 'hidden'
py_script.type = 'text/python3'
// set DIV content to Python source code
py_script.textContent = src
document.body.appendChild(py_script)
// run brython(), searching Python code in DIV tags
brython({debug:1,py_tag:'div'})
// clean up
document.body.removeChild(py_script)
}
py_code = "from browser import doc, html\n"
py_code += "print(doc.getElementById('mydiv'))\n"
py_code += "for i in range(5):\n"
py_code += " doc['mydiv'] <= html.P(i, style = {'backgroundColor': 'cyan'})"
run_python(py_code)
</script>
--
You received this message because you are subscribed to the Google Groups "brython" group.
To unsubscribe from this group and stop receiving emails from it, send an email to brython+u...@googlegroups.com.
To post to this group, send email to bry...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/brython/CAB-sx6383p69vCP6O2vYqFScukqhG9t3nPcP_k%2BHLFC-REF2wg%40mail.gmail.com.
Nice!
To view this discussion on the web visit https://groups.google.com/d/msgid/brython/CAB1ii-d%3Due1ssNfx_3_Z6NAqmQCNs76LOA%2BrJUHxFSyhRoQ5GA%40mail.gmail.com.
Nice!
On Feb 19, 2014 8:13 AM, "Billy Earney" <billy....@gmail.com> wrote:eval(__BRYTHON__.py2js(_src).to_js())_src+="print(dir(unittest))"_src="import unittest\n"this works for me..or you could do it as:
eval(__BRYTHON__.py2js("import unittest;print(dir(unittest))").to_js())
To view this discussion on the web visit https://groups.google.com/d/msgid/brython/CAOLi1KD8WcOQ-nxxSaFdES2SoNHECF0Jtdk5G4JnivK7wJPCvg%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/brython/CAB-sx62HqWsm42R%3D2JRcMuWb3-BR70TnFr13UvC7%2BBZ652rBSQ%40mail.gmail.com.
eval(__BRYTYHON__.py2js(src).to_js()))I think it is best to keep brython internals away from the user as much as possible. So maybe we should implement a src argument to the brython function (or create another javascript function to hold the internal calls) maybe something likefunction brython.eval(src) {
}if this is okay with everyone, I'll look into adding it to py2js.jsBilly
--
You received this message because you are subscribed to the Google Groups "brython" group.
To unsubscribe from this group and stop receiving emails from it, send an email to brython+u...@googlegroups.com.
To post to this group, send email to bry...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/brython/CAB-sx63jJ2qZ0YhdA3CacUx-kx3KVvmFXv_GXRe9jrQ9%2BJwu8A%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/brython/CAB1ii-e-v0-ApVrJCHgJyKNhzZsUyDCJrE52Re4uZgRoYuZe-A%40mail.gmail.com.
I have pushed the changeset with the additional "py_tag" argument, just for testing, but it's probably not the best solutionI just installed iPython on my PC and started playing with the Notebook. I see it's getting very popular ; Kiko, when the integration with Brython is ok it would be great to publish a "howto" about it somewhere