python-eel/Eel

How to pass argument to loop via jinja

Open

#485 aperta il 19 mag 2021

Vedi su GitHub
 (4 commenti) (1 reazione) (0 assegnatari)Python (570 fork)batch import
help wanted

Metriche repository

Star
 (5980 star)
Metriche merge PR
 (Nessuna PR mergiata in 30 g)

Descrizione

Describe the problem How do I pass argument b to a for loop to jinja template?

Code snippet(s) Example:

import eel

eel.init("web")

b = [1,2,3]

eel.start("templates/main.html",size =(350, 400), jinja_templates='templates')
<html>
    <label>
        <div>Example:</div>
        <select name="a">
            {% for a in b %}
                <option value="{{ a }}">{{ a }}</option>
            {% endfor %}
        </select>
      </label>
</html>

Guida contributor