Вопрос

Is there a way to check if a Tkinter canvas has items or is empty?

I tried something like

prints self.canvas.winfo_children()

but it always prints an empty list, items or no items.

Это было полезно?

Решение

You can use self.canvas.find_all() and check if it returns an empty tuple.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top