class Image has no attribute 'fromarray'
The Tkinter
namespace includes the class Image
, so when you wrote
from Tkinter import *
you replaced the definition of Image
with the one from Tkinter
.
import *
can be convenient, especially when working in an interactive shell, but it is not recommended for scripts and bigger programs, for exactly the reason demonstrated in this question. Change that import to
from Tkinter import Tk, Label
(Add any other names that you need to that import statement.)
Better and simple way is change
import Image, ImageTk
to
from PIL import Image as Imgfrom PIL import ImageTk
and
img = Image.fromarray(cv2image)
to
img = Img.fromarray(cv2image)