[Python] FastHtml - Body and Forms

Discussão em 'Python' iniciado por Stack, Maio 19, 2025.

  1. Stack

    Stack Membro Participativo

    I have two section of code

    Body(title, SimSetup, Header, Status, style="margin:20px; width: 1500px")


    and

    SimSetup = Form(
    Input(id = "populationsize",placeholder="Population Size", style = "margin-right:50px;width:300px"),
    Input(id = "DNASize",placeholder="DNA Size", style = "margin-right:50px;width:300px"),
    Input(id = "MutationRate",placeholder="Mutation Rate", style = "width:300px"),
    Button("Reset", style ="margin-right:69px; width: 200px", hx_post="/reset_sim/",hx_target="#Complete", type="submit"),
    Button("Initial Population", style ="margin-right:69px; width: 200px", hx_post=f"/Initial_Population/",hx_target="#Complete",method = "post",type="submit"),
    Button("Next Generation", style ="margin-right:69px; width: 200px", hx_post="/next_generation/",hx_target="#Complete",method = "post",type="submit"),
    Button("Run 100 Generatons", style =" width: 200px", hx_post="/next100_generation/",hx_target="#Complete",method = "post",type="submit"), style= "width:1050px"
    )


    previously this worked fine, now for some reason both get errors like

    return Body(title, SimSetup, Header, Status, style="margin:20px; width: 1500px")


    TypeError: Body() takes from 0 to 1 positional arguments but 4 were given

    does anyone know why and how to fix it, version is python-fasthtml 0.9.1 with python 3.13

    Continue reading...

Compartilhe esta Página