Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let {PythonShell} = require('python-shell')
- var path = require("path")
- function get_weather() {
- var city = document.getElementById("city").value
- var options = {
- scriptPath : path.join(__dirname, '/../engine/'),
- args : [city]
- }
- let pyshell = new PythonShell('weatherApp.py', options);
- pyshell.on('message', function(message) {
- swal(message);
- })
- document.getElementById("city").value = "";
- }
- <html>
- <head>
- <title></title>
- <meta charset="UTF-8">
- </head>
- <body>
- <h1>Get your local weather ...</h1>
- <br>
- <br>
- <label>Enter city name here: <label>
- <input id="city" type = "text" placeholder="City">
- <button type = "button" value="clickme" onclick="get_weather()">Get Weather</button>
- <!--- <button class="btn btn-success" onclick="get_weather();">Go!</button> -->
- <br>
- <br>
- <br>
- <script src="/home/ironmantis7x/Documents/BSSLLC/projects/node_electron/electronDemoApps/guiApp/gui/linkers/weather.js"></script>
- <p><button type="button"><a href="gui.html">Back to Main Page</a></button>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement