Use in a non-sequential manner of easygui.msgbox

浪尽此生 提交于 2020-01-06 15:11:49

问题


If I want display a plotting, with for example matplotlib, AND a popup message with easygui:

plt.show()

msgbox("Hello world", title="Hello")

it is needed to X-close the plotting window to see the popup windows (sequential read of the script). But if I want to display both at the same time?


回答1:


You can use the non-blocking show modes, but then you lose interactivity. You can instead use threads:

from easygui import msgbox
from matplotlib.pyplot import show, plot, draw, ion
from threading import Thread

p = Thread(target=msgbox, args=("Hello world",), kwargs=dict(title="Hello"))
p.start()

plot([1,2,3])
show()

p.join()


来源:https://stackoverflow.com/questions/29411230/use-in-a-non-sequential-manner-of-easygui-msgbox

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!