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
  Unique Tkinter Window kucingkembar 11 2,197 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,009 Jun-28-2024, 01:35 AM
Last Post: deanhystad
  Open files in an existing window instead of new Kostov 2 1,497 Apr-13-2024, 07:22 AM
Last Post: Kostov
  add entries and labels to the window tkinter jacksfrustration 3 2,372 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,563 Oct-02-2023, 04:11 PM
Last Post: deanhystad
  Tkinter button images not showing up lunacy90 7 4,011 Aug-31-2023, 06:39 PM
Last Post: deanhystad
Bug tkinter.TclError: bad window path name "!button" V1ber 2 2,309 Aug-14-2023, 02:46 PM
Last Post: V1ber
  Open a new window does not work Nietzsche 4 2,360 Jun-14-2023, 08:52 AM
Last Post: Nietzsche
  Start print a text after open an async task via button Nietzsche 0 1,171 May-15-2023, 06:52 AM
Last Post: Nietzsche
  Tkinter Entry size limit vman44 3 11,468 Dec-22-2022, 06:58 AM
Last Post: vman44

Forum Jump:

User Panel Messages

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