This is a trivial question, but I still don't know how to do it. I've started up "ipython --pylab" and then: import skimage.io as io c = io.imread('cameraman.jpg') io.imshow(c,'qt') and this gives me an image in a window labelled "skimage". (I'm using Ubuntu 12.04). But how do I close this window from the console? I've tried: plt.close('skimage') plt.close() plt.close('all') plt.close(1) none of which have any effect. I can of course close them with the mouse, but that seems a little inelegant. Is the method to "close" the window in another package entirely? Thanks!
I believe `io.imshow` is provided via a plugin from Matplotlib. Matplotlib's `plt.show()` is a blocking function, which means that until that window is closed nothing else will be executed from the Python shell. So I don't think there's an elegant way to do what you ask, as the design decisions made around that package mean by definition any such `plt.close()` command would not work! It's possible someone has hacked this in, but if so I couldn't find it on short notice. Also, asking the Matplotlib guys about this might yield additional insight. Regards, Josh On Thursday, December 19, 2013 3:59:56 AM UTC-6, Alasdair McAndrew wrote:
This is a trivial question, but I still don't know how to do it. I've started up "ipython --pylab" and then:
import skimage.io as io
c = io.imread('cameraman.jpg')
io.imshow(c,'qt')
and this gives me an image in a window labelled "skimage". (I'm using Ubuntu 12.04). But how do I close this window from the console? I've tried:
plt.close('skimage')
plt.close()
plt.close('all')
plt.close(1)
none of which have any effect. I can of course close them with the mouse, but that seems a little inelegant. Is the method to "close" the window in another package entirely?
Thanks!
I can use matplotlib's imshow: plt.imshow(c,cmap=plt.cm.gray) and this gives me a figure I can close with "plt.close()", but the trouble with this method is that images aren't displayed at "truesize"; that is one image pixel for one screen pixel. And there's isn't a matplotlib parameter which allows me to do this.
participants (2)
-
Alasdair McAndrew
-
Josh Warner