import eel
import pyowm
owm = pyowm.OWM("8a1e96eb0d666fb9f233965c636924bf")
@eel.expose
def get_weather(place):
mgr = owm.weather_manager()
observation = mgr.weather_at_place(place)
w = observation.weather
temp = w.temperature('celsius')['temp']
return "В городе " + place + "сейчас " + str(temp) + " градусов."
eel.init("web")
eel.start("main.html", size=(700 , 700))
HTML
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Погода</title>
<script src="eel.js"></script>
<link rel="icon" type="image/png" href="/favicon.png">
<link rel="stylesheet" type="text/css" href="main.css">
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@300&display=swap" rel="stylesheet">
</head>
<body>
<input id="location" type="text" placeholder="Введите название: Город, Страна..." required="" >
<button id="show">Нажать</button>
<div class="info"></div>
<script src="https://ajax.googleapis.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)();
document.getElementById('info').innerHTML = res;
}
jQuery('#show').on('click', function(){
display_weather();
});
</script>
</body>
</html>