Skip to content

Code is using deprecated getsize() function #120

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

Open
aabaker opened this issue Dec 27, 2023 · 1 comment
Open

Code is using deprecated getsize() function #120

aabaker opened this issue Dec 27, 2023 · 1 comment

Comments

@aabaker
Copy link

aabaker commented Dec 27, 2023

The line

plus a few just below it use the deprecated function getsize() which has been removed in the latest release of Pillow. Using getbbox() instead and then using [3] instead of [1] seems like a reasonable workaround

@thejunglejim
Copy link

Updating the "Write four lines of text." part of the code with the following code fixed the issue for me.

    # Write four lines of text.
    y = top
    draw.text((x, y), IP, font=font, fill="#FFFFFF")
    y += font.getbbox(IP)[3]
    draw.text((x, y), CPU, font=font, fill="#FFFF00")
    y += font.getbbox(CPU)[3]
    draw.text((x, y), MemUsage, font=font, fill="#00FF00")
    y += font.getbbox(MemUsage)[3]
    draw.text((x, y), Disk, font=font, fill="#0000FF")
    y += font.getbbox(Disk)[3]
    draw.text((x, y), Temp, font=font, fill="#FF00FF")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants