0

I am working on a python program that generates output continuosly, Depending upon the user input. I am unable to show this output on Tkinter gui. Without tkinter it just works perfectly on terminal. Could you please suggest some code that will show the output on thr gui.

Here is my python code: Program 1:-

print "Enter a file name:", 
filename = raw_input() 
print filename

This program is executed with gui using second program. Program 2:-

import os 
from Tkinter 
import * root = Tk() 
t = Text(root) 
t.pack() 
def go():     
    p = os.popen("python hello.py")     
    for l in p.xreadlines():         
    t.insert(END, '%s\n' % l.rstrip()) 
    t.see(END) 
    t.update_idletasks() 

Button(root, text='Go', command=go).pack() 
root.mainloop()

Now I want the output to be shown inside tkinter GUI.

ALFA
  • 1
  • 2
  • 1
    Show what you've tried to accomplish this and explain in more detail what didn't work. This is far too broad right now. – Carcigenicate Mar 13 '18 at 12:14
  • My query is similar to https://stackoverflow.com/questions/15362372/display-realtime-output-of-a-subprocess-in-a-tkinter-widget – ALFA Mar 13 '18 at 12:15
  • 1
    That doesn't help explain what you've tried. And that post you linked to doesn't answer your question? – Carcigenicate Mar 13 '18 at 12:16
  • No it didn't helped me, I tried using the answers to that post. But its not helping me. And I will post my code. – ALFA Mar 13 '18 at 12:18
  • 1
    We need to see what code you have used so far. That said it is likely you can use the `insert()` method to get what you want in a gui setting. – Mike - SMT Mar 13 '18 at 12:44
  • Use callback in `after` method of a label where you want to output. – Abhijeetk431 Mar 13 '18 at 13:26

0 Answers0