I'm making an ide using tkinter and i have to create a terminal for it and I found a method to give output and get output to cmd but when i try to insert it's output to terminal that is text widget than my program is not responding and I have to close my program here is my some piece of code please help!
import os
from tkinter import *
def ts():
a = float(t.index('end-1c linestart')) -1
b = t.get(a,END)
for i in os.popen(b,"r"):
break
root = Tk()
t = Text()
t.pack()
Button(command=ts,text="dsfdsfd").pack()
root.mainloop()
CodePudding user response:
I've modified your code a bit. Does this work for you?
import os
from tkinter import *
def ts():
a = float(t.index('end-1c linestart')) -1
b = t.get(a,END)
os.system(b)
root = Tk()
t = Text()
t.pack()
Button(command=ts,text="dsfdsfd").pack()
root.mainloop()