小编And*_*eea的帖子

在同一表格中使用许多提交按钮

我无法访问框架中的所有按钮.它仅适用于直方图按钮.这是我想要在Post方法中访问它的表单.

 <form id="package_form" action="" method="post">
      <div class="panel-body">
          <input type ="submit" name="Download" value="Download">
      </div>
      <div class="panel-body">
          <input type ="submit" name="Histogram" value="Histogram">
      </div>
      <div class="panel-body">
           <input type ="submit" name="Search" value="Search">
      </div>

 </form>
Run Code Online (Sandbox Code Playgroud)

这是我的python代码.

 if request.method == 'GET':
        return render_template("preview.html", link=link1)
    elif request.method == 'POST':
        if request.form['Histogram'] == 'Histogram':
            gray_img = cv2.imread(link2,cv2.IMREAD_GRAYSCALE)
            cv2.imshow('GoldenGate', gray_img)
            hist = cv2.calcHist([gray_img], [0], None, [256], [0, 256])
            plt.hist(gray_img.ravel(), 256, [0, 256])
            plt.xlabel('Pixel Intensity Values')
            plt.ylabel('Frequency')
            plt.title('Histogram for gray scale picture')
            plt.show()
            return render_template("preview.html", link=link1)

        elif request.form.get['Download'] == 'Download': …
Run Code Online (Sandbox Code Playgroud)

html python flask

0
推荐指数
2
解决办法
7433
查看次数

标签 统计

flask ×1

html ×1

python ×1