Experimental
SubmitButton
Create a button. When clicked, the form submits. If submission succeeds (validation checks pass), its value becomes True.
from pathlib import Path
from mininterface import run, Tag
from mininterface.experimental import SubmitButton
m = run()
out = m.form({
"File name": Tag("/tmp", annotation=Path),
"Append text": {
"My text": "",
"Append now": SubmitButton()
},
"Duplicate": {
"Method": Tag("twice", choices=["twice", "thrice"]),
"Duplicate now": SubmitButton()
}
})
# Clicking on 'Append now' button
print(out)
# {'File name': PosixPath('/tmp'),
# 'Append text': {'My text': '', 'Append now': True},
# 'Duplicate': {'Method': 'twice', 'Duplicate now': False}}