tkinter.simpledialog模塊
函數(shù)
- askfloat(title, prompt, **kw)
- askinteger(title, prompt, **kw)
- askstring(title, prompt, **kw)
實例
import tkinter.simpledialog
import tkinter as tk
root = tk.Tk()
root.geometry('600x400')
ety = tk.Entry(root)
ety.pack()
def select():
ety.delete(0,tk.END)
s = tkinter.simpledialog.askstring(title='請輸入',prompt='請輸入名字')
ety.insert(0,s)
btn = tk.Button(root,text='...',command=select)
btn.pack()
root.mainloop()