Quantcast

How to Turn Off Blocking by Method show()

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

How to Turn Off Blocking by Method show()

JonBL
I have a Python program which calls matplotlib's show() method to display a plot, but control does not return to my program until I close the displayed figure. I want control to immediately return to my program so that I can display additional figures as well.

The doco (matplotlib 1.1.1) for the show() method mentions an experimental key word arg named 'block', that can be set to True or False. This looks promising, but plt.show(block = False) raises type error "got an unexpected keyword argument 'block'". A call to plt.show() works fine. The method appears to accept no arguments.

Can anyone suggest how to bypass the blocking behaviour of the show() method?

TIA,
  Jon
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to Turn Off Blocking by Method show()

JonBL
Solved - just discovered methods ion() and ioff() which do the job.
JonBL wrote
I have a Python program which calls matplotlib's show() method to display a plot, but control does not return to my program until I close the displayed figure. I want control to immediately return to my program so that I can display additional figures as well.

The doco (matplotlib 1.1.1) for the show() method mentions an experimental key word arg named 'block', that can be set to True or False. This looks promising, but plt.show(block = False) raises type error "got an unexpected keyword argument 'block'". A call to plt.show() works fine. The method appears to accept no arguments.

Can anyone suggest how to bypass the blocking behaviour of the show() method?

TIA,
  Jon
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to Turn Off Blocking by Method show()

Benjamin Root-2
In reply to this post by JonBL

On Thu, Jul 19, 2012 at 11:34 PM, JonBL <[hidden email]> wrote:

I have a Python program which calls matplotlib's show() method to display a
plot, but control does not return to my program until I close the displayed
figure. I want control to immediately return to my program so that I can
display additional figures as well.

The doco (matplotlib 1.1.1) for the show() method mentions an experimental
key word arg named 'block', that can be set to True or False. This looks
promising, but plt.show(block = False) raises type error "got an unexpected
keyword argument 'block'". A call to plt.show() works fine. The method
appears to accept no arguments.

Can anyone suggest how to bypass the blocking behaviour of the show()
method?

TIA,
  Jon

"The only thing worse than no comments are outdated comments"

IIRC, "block" was long removed from matplotlib.  If you want non-blocking behavior, just call "plt.ion()" to turn interactivity on.  There are other approaches to this problem that you would want to examine if you were truly embedding into an application, but in the most simple cases, just turning interactivity on should do the trick.

Cheers!
Ben Root


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Matplotlib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Loading...