I am trying to make a function which find the number of lines necessary in a Text box for a string "text"
something like this
import tkinter as tk
def get_lines(text):
text_widget = tk.Text(None, width=55, height = 10)
text_widget.configure(font=("Helvetica "+str(12)))
text_widget.insert(tk.END, text)
return text_widget.index('end')
Seems simple enough, right? However, no matter how many lines contained in my text box it returns '2.0'. Can someone confirm that this is just my computer, or let me know what is going on? This seems to be the solution that works for other people.