Python Forum

Full Version: how to open a popup window in tkinter with entry,label and button
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I need to be able to open a pop up window with an Label, Entry and Button widgets. They have to be located from left to right (label/entry/button). I want the button function to output the entry input. The code i have so far is

def open_deposit_popup():
    top=Toplevel(window)
    top.geometry("500x250")
    top.title("Deposit Amount")
    lbl=Label(top,text="Enter Amount: ",font=("Courier 16 normal")).place(relx=1,rely=1,anchor=W)
    entry=Entry(top).place(relx=1,rely=1,anchor=CENTER)
unfortunately the way things are now i dont get to see any of the present widgets which is why the button is missing
I found the solution all by myself. In case anyone needs a pop up window lookup the simpledialog module of tkinter. There is an askstring, askinteger and askfloat function that you can use. The options are title,prompt , parent (which should be the name of your Tk object) minvalue and maxvalue (the latter two are only for askinteger or askfloat)