Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python 3.11 errors out on using Meter #563

Open
itguy217 opened this issue Apr 10, 2024 · 3 comments
Open

Python 3.11 errors out on using Meter #563

itguy217 opened this issue Apr 10, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@itguy217
Copy link

Desktop (please complete the following information):

ttkbootstrap 1.10.1

Describe the bug

Traceback (most recent call last):
File "C:\Users\raadmin\Documents\weather.py", line 34, in
tempMeter = tb.Meter(root, bootstyle="info",subtextstyle="danger", subtext="Current Temp")
File "C:\Users\raadmin\AppData\Local\Programs\Python\Python311\Lib\site-packages\ttkbootstrap\widgets.py", line 718, in init
self._setup_widget()
File "C:\Users\raadmin\AppData\Local\Programs\Python\Python311\Lib\site-packages\ttkbootstrap\widgets.py", line 759, in _setup_widget
self._draw_meter()
File "C:\Users\raadmin\AppData\Local\Programs\Python\Python311\Lib\site-packages\ttkbootstrap\widgets.py", line 856, in _draw_meter
img.resize((self._metersize, self.metersize), Image.CUBIC)
AttributeError: module 'PIL.Image' has no attribute 'CUBIC'. Did you mean: 'BICUBIC'?
Exception in Tkinter callback
Traceback (most recent call last):
File "C:\Users\raadmin\AppData\Local\Programs\Python\Python311\Lib\tkinter_init
.py", line 1967, in call
return self.func(*args)
^^^^^^^^^^^^^^^^
File "C:\Users\raadmin\AppData\Local\Programs\Python\Python311\Lib\site-packages\ttkbootstrap\widgets.py", line 954, in _on_theme_change
self._draw_meter()
File "C:\Users\raadmin\AppData\Local\Programs\Python\Python311\Lib\site-packages\ttkbootstrap\widgets.py", line 856, in _draw_meter
img.resize((self._metersize, self._metersize), Image.CUBIC)
^^^^^^^^^^^
AttributeError: module 'PIL.Image' has no attribute 'CUBIC'

To Reproduce

Have python 3.11 installed.
pip install ttkbootstrap or python -m pip install ttkbootstrap

Run the following code:
create a ttk window and add the following:

Create a meter to visually represent the temperature

tempMeter = tb.Meter(root, bootstyle="info",subtextstyle="danger", subtext="Current Temp")
tempMeter.pack(pady=30)

Expected behavior

Should see a Meter with a number and a visual representation.

Screenshots

No response

Additional context

No response

@itguy217 itguy217 added the bug Something isn't working label Apr 10, 2024
@itguy217
Copy link
Author

Windows 11 Pro

@EVA-JianJun
Copy link

As the attribute Image.CUBIC is deprecated (replaced by Image.BICUBIC) and removed in Pillow v10.0.0. Either install an older version (v9.5.0) of Pillow module or create the attribute explicitly before importing ttkbootstrap module:

from PIL import Image
Image.CUBIC = Image.BICUBIC
import ttkbootstrap as ttk
...

https://stackoverflow.com/questions/76717279/ttkbootstrap-meter-widget-doc-example-not-working

but this is realy a bug.

@setop
Copy link

setop commented Jul 5, 2024

it is fixed in #490 but not relased on pypi.org :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants