>>> from tkinter import *
>>> root=Tk()
>>> text=Text(root,width=40,height=10)    #创建一个text 文本框。长度是40 pixel 高度是10pixel
>>> text.pack()                                           #排版
>>> text.config(wrap = 'word')                    #以word 来wrap? 最短单位是单词
>>> text.get('1.0','end')                               #1表示第一行(从1 开始),。0 表示第一个字节(0开始),end表示整个文本框的结束
'This is a long message in the text box which is more than 40 characters.\n\n\n\n\n\n\nIf the message hits the bottom of the thext box it will run off the screen.\n'
>>> text.get('1.0','1.end')                           #从第一行第一个字节开始到第一行最后
'This is a long message in the text box which is more than 40 characters.'
>>> text.insert('1.0+2 lines','Inserted message')             #  第一行过后两行。第三行 插入内容“Inserted message”
>>> text.get('2.0')                                        #get第二行的第一个字节。 第二行是空的换行所以为\n

'\n'
>>> text.get('3.0')                  
'I'
>>> text.get('3.0','end')
'Inserted message\n\n\n\n\nIf the message hits the bottom of the thext box it will run off the screen.\n'
>>> text.get('3.0','3.end')
'Inserted message'
>>> text.get('4.0','4.end')                           #从第四行第一个字节开始。到底四行结尾
''
>>> text.insert('1.0+2lines lineend','and\nmore and \nmore...')  
>>> text.delete('1.0')                                  #删除第一行第一个字节
>>> text.delete('1.0','1.0 lineend')                 #删除第一行第一个字节开始到第一行最后
>>> text.delete('1.0','3.0 lineend +1 chars')   #删除第一行开始 第三行结束。 并且加上最后一个字节
>>> text.replace('1.0','3.0 lineend','This is the first line.')
>>> text.config(state='disabled')                 #配置text的状态。disable就无法输入了
>>> text.delete('1.0','end')
>>> text.config(state='normal')