漆器 • 1天前
1 from tkinter import *2 import requests3 4 root = Tk()5 root.title('123456')6 root.geometry('800x800+300+200')7 def abc():8 x = ''9 a = requests.get('https://api.tanshuapi.com/api/today_in_history/v1/index?key')10 b = a.text11 for i in range(30,len(b),30):12 y = b[i:i+30]13 x += y+'\n'14 l1 = Label(root, text=x, font=('黑体', 20))15 l1.grid(row=2, column=0)16 l = Label(root, text='点击按钮查询历史上的今天', font=('黑体', 20))17 l.grid(row=0, column=0)18 19 b = Button(root,text='查询',font=('黑体',20),command=abc)20 b.grid(row=1,column=0)21 root.mainloop()22 2 import requests3 4 root = Tk()5 root.title('123456')6 root.geometry('800x800+300+200')7 def abc():8 x = ''9 a = requests.get('https://api.tanshuapi.com/api/today_in_history/v1/index?key')10 b = a.text11 for i in range(30,len(b),30):12 y = b[i:i+30]13 x += y+'\n'14 l1 = Label(root, text=x, font=('黑体', 20))15 l1.grid(row=2, column=0)16 l = Label(root, text='点击按钮查询历史上的今天', font=('黑体', 20))17 l.grid(row=0, column=0)18 19 b = Button(root,text='查询',font=('黑体',20),command=abc)20 b.grid(row=1,column=0)21 root.mainloop()22
评论:
请先登录,才能进行评论