tao tao - 1 year ago 131
Python Question

How to check if a Canvas is empty?

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.

Answer Source

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

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download