Forms And Inputs

Hello all!
I would like to show and have your suggestions. I am using Streamlit about 2 weeks, really enjoing this framework.
By the way, I am not a long python developer too, so be kind on comments. >D
After this brief introduction, I would like to share some thoughts when creating “forms” with streamlit. Dont get me wrong, its easy to do it, my problem is the amount of line in the “main” file.

I like to share with you guys some experiment I have made (but please, if there is a better way to do it, let me know. I will delete this post :D)

I have created a lib to render the forms to abstract the forms creation from the code.
It works like this:

import streamlit as st
import forms

myForms = {
    "login": "./forms/login.json",
    "profile": "./forms/formPerfil.json"
}

forms.initialize(st)

forms.genericForm(myForms.get("login"))
if st.button("Confirm"):
    st.success(f"{forms.getData('user')} clicked")

forms.genericForm(myForms.get("profile"))
if st.button("Save"):
    st.success("Saved")

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.