Python Forum
how to open a popup window in tkinter with entry,label and button - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: how to open a popup window in tkinter with entry,label and button (/thread-40649.html)



how to open a popup window in tkinter with entry,label and button - lunacy90 - Aug-31-2023

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


RE: how to open a popup window in tkinter with entry,label and button - lunacy90 - Sep-01-2023

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)