Button按钮,直接上代码:
from tkinter import * def gs(): global read s=Label(read,text='昨夜西风凋敝树,堵上高楼,望尽天涯路!',background='yellow') s.pack() def h(): s_1=Label(read,text='痴心父母古来多,孝顺儿孙谁见了?',background='red') s_1.pack() read=Tk()#定义父窗口 b1=Button(read,command=gs,text='古诗导读',width=20,height=2)#定义按钮1 b2=Button(read,command=h,text='红楼梦',width=20,height=2)#定义按钮2 b1.pack()#显示按钮1 b2.pack()#显示按钮1 read.mainloop()