0
I’m trying to create a simple notepad, but I have a little problem:
when I try to see if the text of an object Text
is or is not empty:
if text_area.get(0.0, tkinter.END) != "":
print("Text não vazio") # é sempre executado
When I try to use the function len
to control the length of the text, returns 1.
What is this default character? My solution would be to control the length of the text with 1 (or perhaps better, if the length is greater than 1), and if it returns True, it means that it is "empty".
By the way, why Python, or better the bookstore tkinter
provides a text end indicator, ie tkinter.END
, and not at first? Why do I have to put 0.0 (and not tkinter.START
)?
(In comparison for example to the Java language, and in particular to its Swing bookstore, the Tkinter bookstore is really not intuitive, even frank sincerely)
Undoubtedly the Tkinter is an excellent module, but there are other very good ones like Gtk, Qt. Here has something on. About the
len
I still don’t know how to help you.– stderr