<!DOCTYPE html>
<html lang="ru">
<head>
<meta charset="UTF-8">
<title>Погода</title>
<script src="eel.js"></script>
<link rel="icon" type="image/png" href="/weather-icon.png">
<link rel="stylesheet" href="maim.css">
<link href="https://fonts.googleapis.com/ css2?family=Roboto:wght@300;400; 500&display=swap" rel="stylesheet">
</head>
<body>
<form><input id="location" type="text" placeholder="Введите название города..." required=""
value="Нью-Йорк"></form>
<button id="show">Узнать погоду</button>
<div class="info"></div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script type="text/javascript">
async function display_weather(){
let place = document.getElementById('location').value;
let res = await eel.get_weather(place)();
let = document.getElementById('info').innerHTML = res;
}
jQuery('#show').on('click',function(){
//
display_weather();
});
</script>
</body>
</html>
import eel
import pyowm
owm = pyowm.OWM("c6cfc1ad754846160c1e039cbda0e774",)
@eel.expose
def get_weather(place):
mgr = owm.weather_manager()
city = place
observation = mgr.weather_at_place(city)
w = observation.weather
temp = w.temperature('celsius')["temp"]
return "В городе " + city + "е" + " сейчас " + str(temp) + " градусов!"
eel.init("web")
eel.start("maim.html", size=(700, 700))