With this code I was able to create a TK Inter pop-up with a button to run a Sample_Function
.
This Sample_Function
destroys the tk pop-up, runs another python file, and then opens itself (the first pop-up) again.
How can I run the other_python_file
and pop-up 'itself' at the same time — so I can be able to trigger many functions before each one gets completed?
import sys, os
from tkinter import *
import tkinter as tk
root = Tk()
def Sample_Function():
root.destroy()
sys.path.insert(0,'C:/Data')
import other_python_file
os.system('python this_tk_popup.py')
tk.Button(text='Run Sample_Function', command=Sample_Function).pack(fill=tk.X)
tk.mainloop()