How to Use Input Dialog Window Popup in Python using Tkinter

Python course with 57 real-time projects - Learn Python

Program 1

from tkinter import *
import tkinter.simpledialog
import tkinter.messagebox
def btnclick():
    name=tkinter.simpledialog.askstring("Name Box","Enter Your Name:")
    age=tkinter.simpledialog.askinteger("Age Box","Enter Your Age:")
    per=tkinter.simpledialog.askfloat("Per Box","Enter Your Percentages:")
    tkinter.messagebox.showinfo("Result","Name is={} Age is={} Per is={}".format(name,age,per))

myroot=Tk()
myroot.geometry('600x600')
myroot.title("Input Dialog box")
myroot.wm_iconbitmap('2.ico')
myroot.maxsize(600,600)
myroot.minsize(600,600)
mf=Frame(myroot,width=600,height=600,bg='yellow')
mf.pack()
btninput=Button(mf,text="Click",font=('Arial,10,bold'),fg='red',command=btnclick)
btninput.pack()

myroot.mainloop()

 

We work very hard to provide you quality material
Could you take 15 seconds and share your happy experience on Google

follow dataflair on YouTube

Leave a Reply

Your email address will not be published. Required fields are marked *