이 파이썬 코드 :
window = tk.Tk()
t = tk.Text(window2, height=15, width=65)
button = tk.Button(window,text='获 取 IP', command=getIP,width=15, height=2)
def getIP():
# randomIP()的作用是从数据库获取一个ip地址
IP = t.insert('end',randomIP())
다음과 같이 실행 한 후 :
분명히, 우리는 새로운 라인에있는 모든 IP를 한 번 읽을 수 있습니다 함께하면 IP 주소 스틱, 그것은 단지 문을 추가해야합니다 : t.insert(tk.INSERT, '\n')
에
으로는 다음과 같습니다 :
window = tk.Tk()
t = tk.Text(window2, height=15, width=65)
button = tk.Button(window,text='获 取 IP', command=getIP,width=15, height=2)
def getIP():
# randomIP()的作用是从数据库获取一个ip地址
IP = t.insert('end',randomIP())
t.insert(tk.INSERT, '\n')
효과를 한 후 수정 :