israel-dryer / ttkbootstrap

A supercharged theme extension for tkinter that enables on-demand modern flat style themes inspired by Bootstrap.
MIT License
1.9k stars 381 forks source link

AttributeError: module 'PIL.Image' has no attribute 'CUBIC' #492

Closed yefan-abcdefg closed 3 months ago

yefan-abcdefg commented 1 year ago

Desktop (please complete the following information):

Windows Anaconde3 ttkbootstrap Version [e.g. 1.10.1] Python Version 3.8.16 pip Version 20.0.1 pillow Version 10.0.1

Describe the bug

When I copy the __main__.py to my test project and run whith pyinstaller --hidden-import=ttkbootstrap demo.py, it‘s show an error like this.

  File "ttkbootstrap/widgets.py", line 856, in _draw_meter
AttributeError: module 'PIL.Image' has no attribute 'CUBIC'

the Error code:

img.resize((self._metersize, self._metersize), Image.CUBIC)

I found Image.LANCZOS maybe worked.

Can anyone tell me the reason? version mismatch?or just a bug?

I don't want to change widgets.py's code and want have a suitable envs or version.

To Reproduce

No response

Expected behavior

No response

Screenshots

No response

Additional context

No response

rdbende commented 1 year ago

Please people, look at exsisting issues before opening a new one. There are a dozen of issues here already about the exact same problem. Unfortunately it wasn't fixed, because @israel-dryer isn't very active, but you can look at solutions in other threads, for example in #480

yefan-abcdefg commented 1 year ago

Please people, look at exsisting issues before opening a new one. There are a dozen of issues here already about the exact same problem. Unfortunately it wasn't fixed, because @israel-dryer isn't very active, but you can look at solutions in other threads, for example in #480

Think you for reminding me. I'm try use my way, and it works.

I'm fixed it by changing From Image.CUBIC to Image.LANCZOS.

Maybe change to Image.BICUBIC is the best,but my method seen useful also.

rdbende commented 10 months ago

The issue was resolved by the merge of #490. Please close it.

huangstoner commented 5 months ago

怎么这类问题还不解决,刚好想美化下tk,下了发现一堆类似的错误。2024年了5月份了,你们还不更新啊

rdbende commented 5 months ago

Until the Pypi package is updated you can download the package from here and install it manually.

TXLingH commented 5 months ago

前面的@huangstoner,有问题第一时间不找自己问题跑过来抱怨牛魔那 前面已经说了作者本人并不是很活跃所以更新不及时还在这叫 不想用别用

bopo commented 4 months ago

安装小于10的 pillow就可以了

pip install 'pillow<10'

huangstoner commented 3 months ago

@TXLingH 可能你是个大喇叭,看不懂原话不要过来就巴拉巴拉,难道大家不能提建议?你又不是作者装什么清高,真是大无语,我要用不用碍着你了。。。。头一次遇到5^2*10