from tkinter import*
from tkinter import ttk
from tkinter import PIL
from PIL import Image
class Ab:
def __init__(self,root):
self.root=root
self.root.geometry("1530x790 0 0")
self.root.title("Management System")
if __name__=="__main__":
root=Tk()
obj=Ab(root)
root.mainloop()
I am getting an Error while importing PIL. I am not understanding this error as I have already installed Pillow library.
I have removed tkinter but still observing this error: ModuleNotFoundError: No module named 'PIL'. I have already installed Pillow but getting this error.
CodePudding user response:
Remove from tkinter import PIL
. That should solve the problem.
You cannot import PIL from tkinter as PIL is a separate Python Imaging Library.
Once you have installed the Pillow library, you can directly use from PIL import Image
. You need not add PIL
to the namespace before using a function or object provided by PIL.