以非顺序方式使用easygui.msgbox [英] Use in a non-sequential manner of easygui.msgbox

查看:120
本文介绍了以非顺序方式使用easygui.msgbox的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我想显示绘图,例如matplotlib,并显示带有easygui的弹出消息:

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

plt.show()

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

需要X关闭绘图窗口才能看到弹出窗口(顺序读取脚本). 但是,如果我想同时显示两者?

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?

推荐答案

您可以使用非阻塞显示模式 ,但是您失去了交互性.您可以改为使用线程:

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()

这篇关于以非顺序方式使用easygui.msgbox的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆