I am trying to put a terminal into my tk gui program as a widget. I figured out how to have the output of a command sent to a text widget:
root = Tkinter.Tk() tfield = Tkinter.Text(root) tfield.pack() for line in os.popen("run_command", 'r'): tfield.insert("end", line) root.mainloop()
But how can I send info to it? Also, I want to be able to select information from the terminal output as an argument for a function. For example the click of a button launches the command 'iwconfig'. This prints five different wireless extensions and their info into a text widget. Now I want the user to select which extension we will be working with by clicking that (such as wlan0) in the text box. I will later launch another command into the text box which will ask the user to confirm an action by typing 'y'. I would like to do this automatically.
I know this sounds like I'm just asking instead of trying myself, but I can't find anything on this for python. I did find one post of virtually the same question, but it was for perl, and I am 'uni-lingual'.(lol)