【发布时间】:2016-09-20 20:43:49
【问题描述】:
我有一个非常简单的网页,我正在使用它来在 Raspberry Pi 上旋转步进电机。我的 html 文件是这样的:
<html>
<head>
<script Language="Javascript">
function ccw()
{
document.location="cgi-bin/rotate_45_ccw.py";
}
function cw()
{
document.location="cgi-bin/rotate_45_cw.py";
}
</script>
</head>
<body>
<div style="text-align:center">
<h1>Raspberry Pi GPIO</h1>
<br>
<button type="button", id="ccw", onclick="ccw()", value="value CCW">Rotate CCW</button>
<button type="button", id="cw", onclick="cw()", value="value CW">Rotate CW</button>
<br>
</div>
</body>
</html>
我想要做的是在执行任一脚本之后刷新页面(以便用户可以再次单击任一按钮)。我猜的愚蠢方式是让 Python 脚本输出上面的 html 代码。有没有更聪明/更简单的方法?
谢谢!
【问题讨论】:
标签: python raspberry-pi cgi refresh reload