如何关闭用plot()打开的窗口?Python

2024-04-24 10:11:33 发布

您现在位置:Python中文网/ 问答频道 /正文

使用python,我想绘制一个图形,等待1秒,然后绘制另一个图形。到目前为止,我掌握的代码是:

from igraph import *
import time

vertices = ["one", "two", "three"]

edges = [(0,2),(2,1),(0,1)]
g = Graph(vertex_attrs={"label": vertices}, edges=edges, directed=True)
plot(g)

time.sleep(1)

edges = [(2,0),(1,2),(1,0)]
g = Graph(vertex_attrs={"label": vertices}, edges=edges, directed=True)
plot(g)

问题是我必须手动关闭弹出窗口。那么,如何用python指令关闭窗口呢?你知道吗

先谢谢你。你知道吗


Tags: 代码fromimporttrue图形timeplot绘制