I have done 2 separate things and now I want to join the two. I am using command prompt on Windows 8
I have a TCL file that I can run from python. It gives all the outputs on command prompt. I use this command to run the TCL
os.system(r'vivado -mode tcl -source location/my_tcl.tcl')
full code:
import Tkinter as tk
import os
import time
my_gui = tk.Tk()
mvar = tk.StringVar()
def my_hello():
chk = mvar.get()
if chk == '1':
os.system(r'vivado -mode tcl -source path/my_tcl.tcl')
f = open('input.txt', 'r')
a = f.readline().rstrip('\n')
if a == 'Passed':
mlabel = tk.Label(my_gui,text = 'Test Passed', fg = 'black', bg = 'green',width = 10).place(x=200,y=10)
else:
mlabel = tk.Label(my_gui,text = 'Test Failed', fg = 'black', bg = 'red',width = 10).place(x=200,y=10)
f.close
else:
mlabel = tk.Label(my_gui,text = 'No Test Run', fg = 'black', bg = 'yellow',width = 10).place(x=200,y=10)
my_gui.geometry('300x300+200+200')
my_gui.title('Test')
mbutton = tk.Button(my_gui,text = 'Run Tests!',command = my_hello).place(x=150,y=280,anchor= 'center')
check1 = tk.Checkbutton(my_gui,text = 'DDR Test',state = 'active', variable = mvar).place(x=10,y=10)
mvar.set('0')
my_gui.mainloop()
- I have implemented simple logging on python following solutions from this thread: Python Logging to Tkinter Text Widget
full code: https://gist.github.com/bitsgalore/901d0abe4b874b483df3ddc4168754aa
Now I want to combine the two parts but logging require some sort of string input in order to store and display log. while output of TCL appears on command prompt. What i want to achieve is that all that appears on command prompt can be visible on my Tkinter text widget.
Is there a way I can do this? Regards