如何在GUI上显示python控制台



我是编程新手,我想在GUI中的正方形中显示Python控制台,我该怎么做,我只想在GUI 中显示控制台

import os
import tkinter as tk
cmd = os.popen("your console command").read()
r = tk.Tk()
tk.Label(r,text = cmd).grid(row=0,column=0)
r.mainloop()

最新更新