I have 2 python files. one is helloworld.py and 2nd is main.py. In main.py there is button.When i click on that button that time I want to print result of helloworld.py into text box.
helloworld.py
print("hello world")
so I want to print hello world string into main.py textbox
from tkinter import *
import os
root= Tk()
root.title("My First GUI")
root.geometry("800x200")
frame1=Frame(root)
frame1.grid()
def helloCallBack():
result = os.system('python helloworld.py')
if result==0:
print("OK")
text1.insert(END,result)
else:
print("File Not Found")
label1 = Label(frame1, text = "Here is a label!")
label1.grid()
button1 = Button(frame1,text="Click Here" , foreground="blue",command= helloCallBack)
button1.grid()
text1 = Text(frame1, width = 35, height = 5,borderwidth=2)
text1.grid()
radiobutton1 = Radiobutton(frame1, text= "C Programming", value=0)
radiobutton1.grid()
radiobutton2 =Radiobutton(frame1, text= "Python Programming")
radiobutton2.grid()
root.mainloop()