From Subtle Wolf, 1 Month ago, written in Plain Text.
  1. #main script to start the process - testmain.py
  2.  
  3. from multiprocessing import Process,Queue
  4. import testprint
  5.  
  6. counter=5
  7. p=Process(target=testprint.main,args=(counter,))
  8.  
  9. while True:
  10.     comm=input()
  11.     if comm=="print":
  12.         if p.is_alive():
  13.             print("Already running")
  14.         else:
  15.             p.start()
  16.     elif comm=="stop":
  17.         if p.is_alive():
  18.             p.join()
  19.         else:
  20.             print("Not running")
  21.  
  22. #Other script corresponding process p - testprint.py
  23.  
  24. from multiprocessing import Process,Queue
  25. import tkinter as tk
  26.  
  27. def update():
  28.     global label
  29.     global counter
  30.     counter+=1
  31.     label.config(text=str(counter))
  32.     label.after(100,update)
  33.  
  34. def main(c):
  35.     global label
  36.     global counter
  37.  
  38.     window=tk.Tk()
  39.     label=tk.Label(window,width=10)
  40.     label.pack()
  41.  
  42.     counter=c
  43.     update()
  44.     window.mainloop()
  45.  
  46.  
captcha