python - Check if widget exist(Tkinter) -
I want to check that before I delete it, any widgets (such as a rectangle drawn on the canvas) exist is.
Here's my problem: I have two ways, which remove the rectangular I using a Edit: OK, I just got a move if I got itemconfig on deleted widget , I get empty set. I use that value to see if any widget has already been removed or not. I'm not sure that this is a great way to do it though. I think that you can use all items on your canvas to obtain a tuple You can then see if your particular item is bind is connected to the button -1 (when it is clicked it rectangles ) And the second method removes a rectangle, if it is not clicked on a specific time (
Widget.after ). I would like to check whether the rectangle exists in the second method because I want to count the rectangle which was not clicked and the way I can think it has already been removed or not. Is there any way of doing it? Of course, I can set a variable inside the button-1 event handler and see it in another way. But just wanted to know that if
tunicator provides a method like "item existence"
in that Tupl example:
item in my_canvas.find_all (): my_canvas.delete (item) Other: Print ("No Item on Canvas")
Comments
Post a Comment