How can I identify if there is text?

Multi tool use
Multi tool use


I want to identify if there is text on canvas in tkinter.



Can anybody help me please? I have to find out if there is text to avoid an UnboundLocal Error.
Thanks!



If you want to access and update the text variable from the global scope, do so with global. If text is not defined in that scope, you can catch the NameError exception raised.



If text is global, you can use if text not in globals() to check if text is defined. Furthermore, you can use if globals().get('text') which will return False if text is either empty or not defined:



You can do the same thing with locals() inside a function






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Oq5nZLDmP,uxJ1z8yr9bgulOiddBc4YwaNk fcP6 S0tIuQ,9Vz,Ic12J KdZwjUtJBs9ud7ATwkBa8is83R7QFUga,2ktwyaNrrZ,Jnw
yj5UwexpO1,58ZX2CSBN6b2nv 35,2qOHf0L

Popular posts from this blog

The Dalles, Oregon

영화 미래의 미라이 다시보기 (2018) 다운로드 링크 무료보기

Chuyện tình của sao nam Cbiz đem lòng yêu quản lý: Người tìm được chân ái, kẻ vẫn chưa chịu thừa nhận