default/index.html:
{{extend 'layout.html'}}
<h1>cavityflow</h1>
{{=form}}
{{if image:}}
<hr />
<h2>Figure</h2>
<img src="{{=image}}" alt="loading..."/>
{{pass}}

default.py:
def index():
    form=FORM('nx:', INPUT(_name='nx', _value=20.0), BR(), 'ny:',
INPUT(_name='ny', _value=20.0), BR(), 'nt:', INPUT(_name='nt',
_value=100.0), BR(), 'nit:', INPUT(_name='nit', _value=100.0), BR(),
'dt:', INPUT(_name='dt', _value=0.01), BR(), 'vis:',
INPUT(_name='vis', _value=0.1), BR(), 'rho:', INPUT(_name='rho',
_value=1.0), BR(), INPUT(_type='submit',_value='Make figure'))

    image=None
    if form.accepts(request.vars, session, keepvalues=True):
        session.flash = 'Form accepted.'
        session.nx=float(request.vars.nx)
        session.ny=float(request.vars.ny)
        session.nt=float(request.vars.nt)
        session.nit=float(request.vars.nit)
        session.dt=float(request.vars.dt)
        session.vis=float(request.vars.vis)
        session.rho=float(request.vars.rho)
        image=URL(r=request,f='cavityflow_plot')
    return dict(form=form, image=image)

def cavityflow_plot():
    return cavityflow(session.nx, session.ny, session.nt, session.nit,
session.dt, session.vis, session.rho)

def cavityflow(nx, ny, nt, nit, dt, vis, rho):
...*clip* *clip* ... # Here the application will make one hundred png
images.
           os.system("convert *.png cavityflow.gif")
# What do I need to add in here in order to return the cavityflow.gif
onto the webpage of my application?

The question is in the source code as a comment line.

Yours sincerely, Henri Heinonen.

Reply via email to