I have an issue with Tkinter, I'm running this script "index.py" after clicking the button, the script starts running, but I do not get an output anywhere, any remarks?
from tkinter import *
import threading
import subprocess
root = Tk()
frame = Frame(root, width=300, height=300)
frame.pack()
def myClick():
t = threading.Thread(target=run())
t.start()
def run():
arg = "python index.py"
process = subprocess.check_output(arg)
lab = Label(frame, text=process)
lab.pack()
myButton = Button(root, text="run", padx=40, pady=10, command=myClick)
myButton.pack(pady=40)
root.mainloop()
CodePudding user response:
The way you are starting a subprocess
does not work on all platforms.
Every time you click it says "hello".