How can I do terminal emulation in Tk?
• Tk has no built-in terminal widget. There have been a few attempts at making a terminal widget as a Tk extension but none of these implementations have been maintained (i.e., are available for the current version of Tk). This isn’t surprising since all of them had significant limitations and it’s not clear that this was a sensible approach in the first place. • Borrow an external terminal emulator. In particular, you can use TkSteal to control an xterm. You can also control an xterm with Expect (http://expect.nist.gov/). With TkSteal, your xterm physically appears inside the Tk application. And you can send X events to the emulator just like the user. In contrast, Expect gives you control of the backend of the emulator – so you can make the terminal display what you want, rather than being restricted to the output of some existing program. Similarly, when the user enters keystrokes, you can read them and decide if you want to handle them or pass them on to another program. If you wan