|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
请教大佬们,执行第二次和之后的循环怎么清理掉之前显示内容,只显示当前循环的内容
- while True:
- list = ['1','2','3']
- choice = input('num:')
- if choice in list:
- print('yes')
- else:
- print('no')
复制代码
- from tkinter import *
- master = Tk()
- Label(master, text="input:").grid(row=0)
- Label(master, text="result:").grid(row=2)
- e1 = Entry(master)
- e1.grid(row=0, column=1, padx=10, pady=5)
- lst = ['1','2','3']
- def show():
- choice = e1.get()
- e1.delete(0, END)
- if choice in lst:
- Label(master, text="yes").grid(row=2, column=1)
- else:
- Label(master, text="no").grid(row=2, column=1)
- Button(master, text="Button", width=10, command=show).grid(row=3, column=0, sticky=W, padx=10, pady=5)
- Button(master, text="quit", width=10, command=master.quit).grid(row=3, column=1, sticky=E, padx=10, pady=5)
- mainloop()
复制代码
|
|