我创建了一个带有按钮的tkinter gui,按下按钮后,它们在终端中执行一个.py文件。py文件使用代码中的文本文件生成图形,因此它并不总是固定的图像。因此,每次选择按钮并生成新的图形图像时,它都需要出现在gui上。你知道吗
有没有一种方法可以让输出到gui而不是在终端上显示它?你知道吗
我的代码:
def visualise():
with open(example.png, "w") as output:
command = ("python graph.py")
p = subprocess.Popen(command, stdout=output, stderr=output, shell=True)
buttongraph = Tkinter.Button(self, text="generate graph", command=visualise)
buttongraph.pack()
目前没有回答
相关问题 更多 >
编程相关推荐