代码:
from tkinter import * import requests window = Tk() window.geometry('500x350+500+100') window.title('数据采集') frame = Frame(window) frame.pack() Label(frame,text='请输入网站地址:').pack() address = Entry(frame,width=50) address.pack() Label(frame,text='结果将在下方展示:').pack() txt = Text(frame,height=10) txt.pack() def submit(): global txt addr = address.get() res = requests.get(addr).text txt.insert(INSERT,res) Button(frame,text='提交',command=submit).pack() window.mainloop()
效果: