How to use python to start xterm terminal and run commmand in it, After a certain time, send a another command to that terminal

I tried, but the the command in send_command() was not executed

def send_command(): os.system(f"xterm -ti %d -xrm 'XTerm.vt100.allowSendEvents:true' -e 'echo "{command}"/proc/$$/fd/0' " % wid)

##main

top= Toplevel(win)
top.geometry("750x250")
top.title("Child Window")
#Label(top, text= "Hello World!", font=('Mistral 18 bold')).place(x=150,y=80)
termf = Frame(top, height=400, width=500)
termf.pack(fill=BOTH, expand=YES)
wid = termf.winfo_id()
os.system('xterm -into %d -geometry 1000x200 -hold -e  "csh"  &' % wid) 
termf.after(5000, send_command)
0

There are 0 best solutions below