实际上我正在使用下面的 html 代码,它定义了网络服务器:
def web_page_with_water():
global Desired_Temp
html = """<html>
<head>
<title>Thermocirculator</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" href="data:,">
<meta http-equiv="refresh" content="0.2">
<style>
html
{font-family: Arial;
display:inline-block;
margin: 0px auto;
text-align: center;}
h1
{color: #000000;
padding: 2vh;}
p
{font-size: 1.5em;}
.button
{display: inline-block;
background-color: #e7bd3b;
border: 2px solid #FFFFFF;
border-radius: 8px;
color: white;
padding: 16px 40px;
text-decoration: none;
font-size: 30px;
width: 100px;
margin: 2px;
cursor: pointer;
-webkit-transition-duration: 0.4s; /* Safari */
transition-duration: 0.4s;}
.button:hover
{background-color: #FFFFFF; /* Green */
color: #e7bd3b;
border: 2px solid #e7bd3b;}
.button2
{background-color: #4286f4;}
.button2:hover
{background-color: #FFFFFF; /* Green */
color: #4286f4;
border: 2px solid #4286f4;}
</style>
</head>
<body>
<h1>Thermocirculator Web Server</h1>
<br>
<p>Thermocirculator internal temperature: <strong>""" + str(round(Intern_Temp,1)) + """</strong></p>
<p>Cooler status: <strong>""" + cooler_State + """</strong></p>
<br>
<p>Current Water temperature: <strong>""" + str(round(water_temp,1)) + """</strong></p>
<br>
<p>Desired Water temperature: <strong>""" + str(round(desired_temp,1)) + """</strong></p>
<div style="display: inline-block;">
<a href="/?Minus_Button_Web=on"><button class="button button2">-</button></a>
<a href="/?Plus_Button_Web=on"><button class="button">+</button></a>
</div>
</body>
</html>"""
return html
............................................... .....................................
............................................... .....................................
我确实喜欢这些按钮只有在我按下它们时才会激活,而不是在网络服务器重新加载时激活。
我不知道该怎么办。
请帮帮我,这是我的本科期末论文。
............................................... ...............................................................