Only accept missing tkinter when building wheels on Windows by radarhere · Pull Request #8981 · python-pillow/Pillow

# tkinter is not available in cibuildwheel installed CPython on Windows
try:
import tkinter
assert tkinter
except ImportError:
expected_modules.remove("tkinter")

Let's increase the specificity of this code to only silently catch the error on Windows, as per the comment.

Since this PR hasn't actually triggered a Wheels job, I'll point to https://github.com/radarhere/Pillow/actions/runs/15235083611 as evidence that this does still pass.