from magicgui import magicgui
from magicgui.widgets import request_values
try:
vals = request_values(
age={"annotation": int, "label": "Age:"},
name={"annotation": str, "label": "Enter your name:"},
qidong={"annotation": bool, "label": "Start or not?"},
title="Hi, who are you?",
)
# print(type(vals)) #
print(vals["age"])
print(vals["name"])
except Exception as e:
print(e)
print("You rejected the input, the program ended!")
I am very pleased to recommend a library for adding pop ups, which can add some login windows and pop up pages
It's very simple, there's no need for learning costs
https://github.com/pyapp-kit/magicgui