Python Forum
how to open a popup window in tkinter with entry,label and button
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
how to open a popup window in tkinter with entry,label and button
#1
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
Reply
#2
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)
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Tkinter: Problem with storing data from one window to the other iforire 1 209 May-11-2025, 01:31 PM
Last Post: deanhystad
  tkinter only storing last element/data from entry widget bertschj1 8 787 May-06-2025, 11:54 PM
Last Post: deanhystad
  Unique Tkinter Window kucingkembar 11 2,496 Aug-11-2024, 01:49 PM
Last Post: deanhystad
  How to change a tkinter label with scale and how to save that new value for later? bkeith 3 2,230 Jun-28-2024, 01:35 AM
Last Post: deanhystad
  Open files in an existing window instead of new Kostov 2 1,601 Apr-13-2024, 07:22 AM
Last Post: Kostov
  add entries and labels to the window tkinter jacksfrustration 3 2,565 Oct-10-2023, 06:41 PM
Last Post: buran
  Is there a way to call and focus any popup window outside of the main window app? Valjean 6 5,875 Oct-02-2023, 04:11 PM
Last Post: deanhystad
  Tkinter button images not showing up lunacy90 7 4,317 Aug-31-2023, 06:39 PM
Last Post: deanhystad
Bug tkinter.TclError: bad window path name "!button" V1ber 2 2,457 Aug-14-2023, 02:46 PM
Last Post: V1ber
  Open a new window does not work Nietzsche 4 2,451 Jun-14-2023, 08:52 AM
Last Post: Nietzsche

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020