Answer the question
In order to leave comments, you need to log in
How to connect files and display an image?
This is a program with an interface in python, html, js, jQuery, I wrote according to the lesson of Howdy Ho, at 6:49 I noticed that the files are not connected, and the window is not even called. Help me please. Howdy Ho video: https://www.youtube.com/watch?v=Gon0MvppfF8&t=409s
HTML
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Дарова</title>
<style type="text/css">
body{
background: #00d2ff;
}
#location {
display: block;
border: none;
background: rgba(255, 255, 255, .5);
border-radius: 10px;
padding: 20px;
color: white;
outline: none;
width: 100%;
font-size: 30px;
}
#location::placeholder {
color: rgba(255, 255, 255, .5);
}
#show{
text-decoration:none;
margin-top: 50px;
padding-top:15px;
padding-bottom: 15px;
width: 100%;
border:groove 1px #252525;
-webkit-border-radius:4px;
-moz-border-radius:4px;
border-radius: 4px;
font:20px Verdana, Geneva, sans-serif;
font-weight:bold;
color:#141414;
background-color:#ddecdf;
cursor:pointer;
}
</style>
<script src="eel.js"></script>
<script src="https://code.jquery.com/jquery-3.6.0.min.js" integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4=" crossorigin="anonymous"></script>
</head>
<body>
<input id="location" type="text" placeholder="Введите название страны и города ..." required="" value="Нью-Йорк, США">
<button id="show">Узнать погоду</button>
<div class="info">
</div>
<script type="text/javascript">
async function display_weather() {
let place = document.getElementBy('location').value;
let res = await eel.get_weather(place)();
document.getElementById('info').innerHTML = res;
}
jQuery('#show').on('click', function(){
display_weather();
});
</script>
</body>
</html>
import eel
import pyowm
owm = pyowm.OWM("586eb7f9a57d72046bcebd873e656736")
@eel.expose
def get_weather(place):
city = place
mgr = owm.weather_manager()
observation = mgr.weather_at_place(city)
w = observation.weather
temp = w.temperature('celsius')['temp']
return "В городе " + city + " сейчас " + str(temp) + " градусов!"
# eel.init("web")
# eel.start("index.html" , size=(700, 700))
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question