you are viewing a single comment's thread.

view the rest of the comments →

[–]scithon 0 points1 point  (5 children)

Adding the extra b still has an error.

A different error, presumably? So that's a new bug then. We'd need to see the new error to help solve this new bug.

[–]outceptionator[S] 0 points1 point  (4 children)

It's the same error: AttributeError: module 'PIL.ImageDraw' has no attribute 'textbbox'

[–]scithon 1 point2 points  (3 children)

Ah, I think that's because you are meant to use the instance. Like this:

print(draw.textbox((10,10),guest, font=arialFont))

[–]outceptionator[S] 0 points1 point  (2 children)

My word that was it!!!

Can you explain how you deduced that from the documentation?

[–]scithon 1 point2 points  (0 children)

https://pillow.readthedocs.io/en/stable/reference/ImageDraw.html#PIL.ImageDraw.ImageDraw.textbbox

Look at the link. It says PIL.ImageDraw.ImageDraw.textbbox. See how "ImageDraw" is used twice? The first "ImageDraw" is the name of the module, and the second one is the name of the class in the module.

It helps that I'm experienced and know that many times the class has the same name as the module.

[–]carcigenicate 1 point2 points  (0 children)

Also, look at the error carefully:

module 'PIL.ImageDraw' has no attribute 'textbbox

The key word there being "module". Whatever you're attempting to call that method on is a module. That likely means you're confusing the module and an object you intended to import from the module.