I'm trying to figure out how ginput(3) works in this code, but when I run it, it returning a UserWarning saying: "matplotlib is currently using a non-GUI backend, "
Please help me out on this.
from PIL import Image
from pylab import *
im = array(Image.open('empire.jpg'))
imshow(im)
print ('Please click 3 points')
x = ginput(3)
print ('you clicked:',x)
show()
UserWarning: matplotlib is currently using a non-GUI backend, so cannot show the figure "matplotlib is currently using a non-GUI backend, "
You can take a quick look at what a backend in matplotlib refers to, by checking out this link.
Thanks @ImportanceOfBeingErnest for providing me with the necessary resource.
import matplotlib
#Use the line below to set a backend for matplotib
matplotlib.use('TkAgg')
from PIL import Image
from pylab import *
im = array(Image.open('empire.jpg'))
imshow(im)
print ('Please click 3 points')
x = ginput(3)
print ('you clicked:',x)
show()
You could try out these other GUI backends in the given order, if "TkAgg" doesn't work out for you.