Home > database >  Can't get an output to Tkinter GUI
Can't get an output to Tkinter GUI

Time:08-26

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.

As enter image description here

Every time you click it says "hello".

  • Related