我想要使用python,html和javascript构建桌面应用程序。到目前为止,我已经跟随了瓶子上的内容,并有一个你好世界工作的例子。我现在应该做些什么来使它工作? html文件如何与他们下面的python脚本“交谈”?Flask,html和javascript桌面应用程序
这里是到目前为止我的代码:
from flask import Flask, url_for, render_template, redirect
app = Flask(__name__)
@app.route('/hello/')
@app.route('/hello/<name>')
def hello(name=None):
return render_template('hello.html', name=name)
@app.route('/')
def index():
return redirect(url_for('init'))
@app.route('/init/')
def init():
css = url_for('static', filename='zaab.css')
return render_template('init.html', csse=css)
if __name__ == '__main__':
app.run()
HTML文件从不与Python脚本“交谈”。 Python(通过Flask)将使用Jinja2使用传递给render_template()的任何信息来呈现HTML文件。你应该在这里完成教程:http://flask.pocoo.org/docs/tutorial/introduction/事情会在事后变得更有意义。 – EML 2012-07-12 16:29:41
好吧,这是有道理的,但我怎么能通过数据呢?例如。通过一些表格的数据 – 2012-07-12 16:51:20