Tkinter's `Label` only stores `PhotoImage` references at the C level, so Python GC eats them unless something on the Python side keeps a reference. The canonical fix is to stash the reference on the widget itself: `label.image = photo`. Tkinter widgets are plain Python objects, so the assignment works at runtime, but the stub declares no `image` attribute (correctly — there isn't one; we're adding it). Narrow the suppression to `# type: ignore[attr-defined]` on the one line. The existing comment above the assignment already documents why.
5.7 KiB
5.7 KiB