0

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?

matsjoyce
  • 5,744
  • 6
  • 31
  • 38
servoz
  • 606
  • 9
  • 22

1 Answers1

0

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()
Community
  • 1
  • 1
matsjoyce
  • 5,744
  • 6
  • 31
  • 38
  • Ok thank you for your help and suggestion ! I started to play with the idea but I do not yet succeed. I post a new question more on the thread idea subject. Thanks again ! – servoz Apr 03 '15 at 16:11
  • @servoz If this works could you please [accept](http://meta.stackexchange.com/questions/5234/how-does-accepting-an-answer-work) this answer, so that other users know this problem has been solved. – matsjoyce Apr 03 '15 at 17:38
  • No, finally, with threads I do not succeed to do what I want !!! [link] http://stackoverflow.com/questions/29436147/python-multi-threading – servoz Apr 08 '15 at 11:57
  • It may be possible, but I think because you are running two windowing systems (Tk for easygui and whatever matplotlib is using) you are asking for trouble. Maybe you are better off forgetting about easy gui and add buttons to you matplotlib plot. They are described here: http://matplotlib.org/examples/widgets/index.html?highlight=widgets – Robert Lugg May 14 '15 at 13:13