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
  Open files in an existing window instead of new Kostov 2 326 Apr-13-2024, 07:22 AM
Last Post: Kostov
  add entries and labels to the window tkinter jacksfrustration 3 635 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 1,799 Oct-02-2023, 04:11 PM
Last Post: deanhystad
  Tkinter button images not showing up lunacy90 7 1,614 Aug-31-2023, 06:39 PM
Last Post: deanhystad
Bug tkinter.TclError: bad window path name "!button" V1ber 2 805 Aug-14-2023, 02:46 PM
Last Post: V1ber
  Open a new window does not work Nietzsche 4 1,106 Jun-14-2023, 08:52 AM
Last Post: Nietzsche
  Start print a text after open an async task via button Nietzsche 0 715 May-15-2023, 06:52 AM
Last Post: Nietzsche
  Tkinter Entry size limit vman44 3 6,758 Dec-22-2022, 06:58 AM
Last Post: vman44
  Pyspark Window: perform sum over a window with specific conditions Shena76 0 1,185 Jun-13-2022, 08:59 AM
Last Post: Shena76
Sad Selenium: can't open a new window after clicking a button and I don't know why noahverner1995 0 1,990 Jan-22-2022, 09:55 AM
Last Post: noahverner1995

Forum Jump:

User Panel Messages

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