我正在使用以下Python代码将终端窗口(来自Ubuntu Linux)嵌入到Tkinter窗口中。当终端窗口启动时,我想自动在窗口中执行命令'sh kBegin':
我该如何使它工作?
from Tkinter import *
from os import system as cmd
root = Tk()
termf = Frame(root, height=800, width=1000)
termf.pack(fill=BOTH, expand=YES)
wid = termf.winfo_id()
cmd('xterm -into %d -geometry 160x50 -sb &' % wid)
root.mainloop()
伪类:
cmd('xterm -into %d -geometry 160x50 -sb &' % wid)
embedded_terminal('sh kBegin')
# EMBEDDED TERMINAL DISPLAYS OUTPUT OF sh kBegin##
我该如何使它工作?
xterm -into ... -sb -hold -e sh kBegin
- mgilsonxterm ... -e "sh kBegin;bash"
,但不是很多。虽然我不确定你是否能走得更远...(参考)http://www.gossamer-threads.com/lists/python/python/669765 - mgilson