使用该
index方法查找“ end”的值,该值是缓冲区中最后一个字符之后的位置。
>>> text_widget.index('end') # returns line.column '3.0'>>> int(text_widget.index('end').split('.')[0]) - 1 # returns line count2*根据Bryan Oakley的评论进行的 *更新 :
>>> int(text_widget.index('end-1c').split('.')[0]) # returns line count2


