ParthJadhav / Tkinter-Designer

An easy and fast way to create a Python GUI 🐍
BSD 3-Clause "New" or "Revised" License
8.63k stars 794 forks source link

AttributeError: module 'PILImage' has no attribute 'ANTIALIAS" #369

Open x0bi3 opened 8 months ago

x0bi3 commented 8 months ago

I followed the instructions to a T and also scoured this hub and other forums in search for assistance before posting... But man I'm stuck. I did all the uninstalls/reinstalls, old versions, etc Link to the Figma File https://www.figma.com/file/f0aMmv2zOBvO0EEh8kBBET/Untitled?type=design&node-id=0-1&mode=design&t=AJrPGhcfNdiPtpoG-0

PS C:\Users\*****> & C:/Users*****/AppData/Local/Programs/Python/Python312/python.exe c:/Users/*****/AppData/Local/Programs/Python/Python312/Tkinter-Designer-master/gui/gui.py
Creating Element { name: rectangle 1, type: rectangle }
Creating Element { name: username/password organizer, type: text }
Creating Element { name: textbox, type: rectangle }
Exception in Tkinter callback
Traceback (most recent call last):
  File "C:\Users\*****\AppData\Local\Programs\Python\Python312\Tkinter-Designer-master\tkdesigner\designer.py", line 21, in to_code
    frame = Frame(f, self.figma_file, self.output_path, self.frameCounter)
  File "C:\Users\*****\AppData\Local\Programs\Python\Python312\Tkinter-Designer-master\tkdesigner\figma\frame.py", line 30, in __init__
    self.create_element(child)
  File "C:\Users\*****\AppData\Local\Programs\Python\Python312\Tkinter-Designer-master\tkdesigner\figma\frame.py", line 65, in create_element
    download_image(image_url, image_path)
  File "C:\Users\*****\AppData\Local\Programs\Python\Python312\Tkinter-Designer-master\tkdesigner\utils.py", line 23, in download_image
    im = im.resize((im.size[0] // 2, im.size[1] // 2), Image.ANTIALIAS)
AttributeError: module 'PIL.Image' has no attribute 'ANTIALIAS'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\*****\AppData\Local\Programs\Python\Python312\Lib\tkinter\__init__.py", line 1948, in __call__
    return self.func(*args)
           ^^^^^^^^^^^^^^^^
  File "c:\Users\*****\AppData\Local\Programs\Python\Python312\Tkinter-Designer-master\gui\gui.py", line 72, in btn_clicked
    designer.design()
  File "C:\Users\*****\AppData\Local\Programs\Python\Python312\Tkinter-Designer-master\tkdesigner\designer.py", line 32, in design
    code = self.to_code()
  File "C:\Users\*****\AppData\Local\Programs\Python\Python312\Tkinter-Designer-master\tkdesigner\designer.py", line 23, in to_code
    raise Exception("Frame not found in figma file or is empty")
Exception: Frame not found in figma file or is empty

The closest I can come to identifying the problem is:

  _File "C:\Users\*****\AppData\Local\Programs\Python\Python312\Tkinter-Designer-master\tkdesigner\utils.py", line 23, in download_image
    im = im.resize((im.size[0] // 2, im.size[1] // 2), Image.ANTIALIAS)
AttributeError: module 'PIL.Image' has no attribute 'ANTIALIAS'_

And I remember the instructions saying PIL needs to be uninstalled prior to installing Pillow... But any time I run the .requirements or the gui.py, the PIL folder is redownloaded and causes this error.

After deleting PIL folder, I try to run the app again, and I'm presented with a new and different problem...

Traceback (most recent call last): File "c:\Users\Ronathan\AppData\Local\Programs\Python\Python312\Tkinter-Designer-master\gui\gui.py", line 13, in <module> from tkdesigner.designer import Designer File "C:\Users\Ronathan\AppData\Local\Programs\Python\Python312\Tkinter-Designer-master\tkdesigner\designer.py", line 2, in <module> from tkdesigner.figma.frame import Frame File "C:\Users\Ronathan\AppData\Local\Programs\Python\Python312\Tkinter-Designer-master\tkdesigner\figma\frame.py", line 2, in <module> from ..utils import download_image File "C:\Users\Ronathan\AppData\Local\Programs\Python\Python312\Tkinter-Designer-master\tkdesigner\utils.py", line 5, in <module> from PIL import Image ModuleNotFoundError: No module named 'PIL'

So now I'm at a loss, Can't have PIL, but won't move forward without downloading it first... Please help lol

taisecrets2002 commented 7 months ago

Hey....had the same problem...apparently going to utils.py and adding a line of 'Image.ANTIALIAS = Image.LANCZOS" after 'from PIL import Image' helped. but that's a cowboy solution that I found