Python Tkinter 终端集成

Python Tkinter terminal integration

我正在尝试在我的 Python 脚本中集成一个终端。我最终让它工作了,但它在左侧显示了一个红色条,我想摆脱它。

代码是这样的:

from Tkinter import *
import os

root = Tk()
root.title("My Program")
Terminal = Frame(root, height = 400, width = 500)
Terminal.pack(fill = BOTH, expand = YES)
winfo = Terminal.winfo_id()
os.system("xterm -into %d -geometry 40x200 -sb &" % winfo)

root.mainloop()

左边的红条是xterm的滚动条。从命令中删除 -sb 选项以消除该选项:

os.system("xterm -into %d -geometry 40x200 &" % winfo)

manual

-sb

This option indicates that some number of lines that are scrolled off the top of the window should be saved and that a scrollbar should be displayed so that those lines can be viewed. This option may be turned on and off from the "VT Options" menu.