from tkinter import *
import threading
def process():
while True:
print("Hello World")
processThread = threading.Thread(target=process)
def main():
mainWindow = Tk()
mainWindow.resizable(FALSE, FALSE)
mainWindow.title("Text")
mainWindow.geometry("500x250")
recButton=Button(mainWindow)
recButton.config(text="Button 1", font=("Arial", "13"), bg="red",fg="white", width="15", command=processThread.run)
recButton.place(x=15,y=10)
stopButton=Button(mainWindow)
stopButton.config(text="Button 2", font=("Calibri", "13"), bg="orange",fg="white", width="15", command="")
stopButton.place(x=15,y=55)
mainWindow.mainloop()
mainThread = threading.Thread(target=main)
mainThread.start()