実際のところ
import tkinter as tk import tkinter.messagebox def preprocess(): #ここに前処理めいたの print("preprocess") def mainprocess(): #ここに本処理 print("main process") def button_click(): print("Button clicked") preprocess() result = tkinter.messagebox.askyesno("Confirmation", "Do you confirm?") if result: # ユーザーが「はい」を選択した場合 print("You checked") mainprocess() root = tk.Tk() button = tk.Button(root, text="Click me", command=button_click) button.pack() root.mainloop()