也许是这样的:
from tkinter import *
root = Tk()
def mainfunction():
#stuff your program is supposed to do
runmain = False
def runtheprogram():
runmain = True
b1 = Button(root, text="Start", command=runtheprogram)
b1.pack()
if runmain:
mainfunction()
root.mainloop()