Guest User

Untitled

a guest
Nov 21st, 2017
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. from IPython.display import display,Javascript
  2. Javascript('echo("sdfds");',lib='/home/student/Gl.js')
  3.  
  4. function echo(a){
  5. alert(a);
  6. }
  7.  
  8. from IPython.display import display, HTML
  9. js = "<script>alert('Hello World!');</script>"
  10. display(HTML(js))
  11.  
  12. define(function(){
  13.  
  14. var foo = function(){
  15. console.log('bar');
  16. }
  17.  
  18. return {
  19. foo : foo
  20. }
  21. });
  22.  
  23. $([IPython.events]).on('notebook_loaded.Notebook', function(){
  24.  
  25. require(['custom/myScript'], function(custom){
  26. window.foo = custom.foo;
  27. } );
  28.  
  29. });
  30.  
  31. %%javascript
  32.  
  33. foo();
  34.  
  35. %%javascript
  36. require.config({
  37. paths: {
  38. d3: '//cdnjs.cloudflare.com/ajax/libs/d3/3.4.8/d3.min'
  39. }
  40. });
  41.  
  42. %%javascript
  43. element.append("<div id='chart1'></div>");
  44.  
  45. from IPython.display import Javascript
  46. #runs arbitrary javascript, client-side
  47. Javascript("""
  48. window.vizObj={};
  49. """.format(df.to_json()))
Add Comment
Please, Sign In to add comment