详解tkinter.Text.get(start, end)

tkinter.Text.get(start, end)

上述函数有两个参数;

比如:start为保留一位小数的小数形式或字符串形式;

例子:

from tkinter import *

root = Tk()
text1 = Text(root,width=30,height=10)
text1.pack()

text1.insert(INSERT,'lan\r\nlu\r\nyug')
contents = text1.get('1.2',END)
print(contents)
mainloop()

输出:

   

tkinter.Text.get('1.2', END)这个函数,其中第一个参数‘1.2’是指从第一行第2列进行读取(‘1.0’表示第一行第一列,即第一个字符),第二个End表示最后一个字符,输出框便如左图所截取。

猜你喜欢

转载自blog.csdn.net/lanluyug/article/details/84076529
end