Advertisement
Guest User

Untitled

a guest
Aug 18th, 2019
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.08 KB | None | 0 0
  1. let {PythonShell} = require('python-shell')
  2. var path = require("path")
  3.  
  4. function get_weather() {
  5.  
  6. var city = document.getElementById("city").value
  7.  
  8. var options = {
  9. scriptPath : path.join(__dirname, '/../engine/'),
  10. args : [city]
  11. }
  12.  
  13. let pyshell = new PythonShell('weatherApp.py', options);
  14.  
  15.  
  16. pyshell.on('message', function(message) {
  17. swal(message);
  18. })
  19. document.getElementById("city").value = "";
  20. }
  21.  
  22. <html>
  23. <head>
  24. <title></title>
  25. <meta charset="UTF-8">
  26. </head>
  27. <body>
  28.  
  29. <h1>Get your local weather ...</h1>
  30. <br>
  31. <br>
  32. <label>Enter city name here: <label>
  33. <input id="city" type = "text" placeholder="City">
  34. <button type = "button" value="clickme" onclick="get_weather()">Get Weather</button>
  35. <!--- <button class="btn btn-success" onclick="get_weather();">Go!</button> -->
  36. <br>
  37. <br>
  38. <br>
  39. <script src="/home/ironmantis7x/Documents/BSSLLC/projects/node_electron/electronDemoApps/guiApp/gui/linkers/weather.js"></script>
  40. <p><button type="button"><a href="gui.html">Back to Main Page</a></button>
  41.  
  42. </body>
  43. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement