Problem : Python Tkinter User form needs to be closed to pass data

Hi,
I did a simple test to use tkinter in grasshopper with Rhino 8. Currently I need to close the interface for the data to pass. But I would like to be able to keep the interface open and when I click on the button the data is passed to grasshopper.

import customtkinter as ctk

def on_calculate():
    value_a = entry_a.get()
    print(f"Valeur de a : {value_a}")


# Init
app = ctk.CTk()
app.geometry("300x200")
app.title("UserForm")

# Value a
label_a = ctk.CTkLabel(app, text="Value :")
label_a.pack(pady=10)

entry_a = ctk.CTkEntry(app)
entry_a.pack(pady=10)

#Set button
button_calculate = ctk.CTkButton(app, text="Calculate", command=on_calculate)
button_calculate.pack(pady=20)

print (button_calculate)
app.mainloop()

Thanks for ur help !

I am not familiar with Custom TkInter, but glancing through the docs maybe you want a CTkTopLevel instead? Not sure how integral the mainloop mechanism is to the functioning of the library.

Any reason to not use Eto.Forms instead of Custom TkInter?

Thanks for your reply. I just wanted to use tkinter because I know that I can integrate other libraries like matplotlib etc…But if it works better with eto.forms, why not