用户:
tq_xyy查看:13 回复:6 评论:13 创建时间:2020-05-11T19:09:31
tkinter:
import tkinter as tk
import tkinter.messagebox as tkbox
w = tk.Tk()
w.geometry('250x100')
w.title('')
tk.Label(w,text="What is your favorite ice cream flavor?").pack()
flavor = tk.StringVar()
flavor.set('Vanilla')
tk.Entry(w,show=None,textvariable=flavor).pack()
def ok():
tkbox.showinfo(message="You entered " + flavor.get())
tk.Button(w,text='OK',command=ok).place(x=75,y=60)
tk.Button(w,text='Cancel',command=exit).place(x=125,y=60)
w.mainloop()
easygui:
import easygui
flavor = easygui.enterbox("What is your favorite ice cream flavor?",default = 'Vanilla')
easygui.msgbox ("You entered " + flavor)
看上去好像easygui更简单一些。
伴雪纷飞别诽谤tkinter哈..
诺诺,tkinter其实也有
无需自己肝ui的
import tkinter.simpledialog
tkinter.Tk().withdraw()
tkinter.messagebox.showinfo(message='You entered {}'.format(tkinter.simpledialog.askstring(
title=' ', prompt="What is your favorite ice cream flavor?", initialvalue='Vanilla')))
差不了多少,且tkinter的功能多
点赞2
评论