There python code:
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())
After running like this:
Obviously, ip address stick together if we are to read once every ip on a new line, it would only need to add the statement: t.insert(tk.INSERT, '\n')
to
As follows:
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')
Modifying effect after: