Python Forum
Transfer Toplevel window entry to root window entry with TKinter
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Transfer Toplevel window entry to root window entry with TKinter
#1
With Tkinter, on a PopUp Toplevel window with an Entry and Button, when Destroy by the button, I want the TopLevel window Entry to be transferred to my root window entry. The code below transfer the root window entry value to the popup window entry. If the entry of the popup window is changed, how to transfer it to the root window entry?

  1. from tkinter import *
    root = Tk()
    root.geometry("250x100")
    root.title("Root Window")
    
    
    def open_popup(num):
    popup = Toplevel()
    popup.title("PopUp")
    popup.geometry("250x100")
    
    value = Entry(popup)
    value.place(height=25, width=25, x=100, y=10)
    value.insert(0, str(num))
    
    btn_ok = Button(popup, text="Return", command=popup.destroy)
    btn_ok.place(height=30, width=60, x=90, y=45)
    
    
    main_entry = Entry(root)
    main_entry.place(height=25, width=30, x=110, y=10)
    main_entry.insert(0, "111")
    
    button_ok = Button(
    root, text="OK", command=lambda: open_popup(main_entry.get()))
    button_ok.place(height=30, width=30, x=110, y=45)
    
    root.mainloop()
Reply


Messages In This Thread
Transfer Toplevel window entry to root window entry with TKinter - by HBH - Jan-23-2020, 09:00 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Interaction between Matplotlib window, Python prompt and TKinter window NorbertMoussy 3 347 Mar-17-2024, 09:37 AM
Last Post: deanhystad
  ValueError: could not convert string to float: '' fron Entry Widget russellm44 5 499 Mar-06-2024, 08:42 PM
Last Post: russellm44
  [Tkinter] CTkScrollableDropdown error: bad window path name ".!ctkscrollabledropdown" CopperGenie 1 219 Mar-03-2024, 04:32 AM
Last Post: deanhystad
  [Tkinter] (CLOSED) CTkScrollableDropdown error: bad window path name ".!ctkscrollabledropdown" CopperGenie 4 421 Mar-03-2024, 03:21 AM
Last Post: CopperGenie
  Transparent window background, but not text on it muzicman0 7 2,738 Feb-02-2024, 01:28 AM
Last Post: Joically
  pass a variable between tkinter and toplevel windows janeik 10 2,140 Jan-24-2024, 06:44 AM
Last Post: Liliana
  Tkinter multiple windows in the same window tomro91 1 788 Oct-30-2023, 02:59 PM
Last Post: Larz60+
  [Tkinter] Modal window DPaul 14 2,331 Oct-18-2023, 06:11 AM
Last Post: DPaul
  [PyQt] PyQt5 window closing when trying to display a graph bianca 4 1,622 Aug-12-2023, 03:25 PM
Last Post: bianca
Exclamation [Tkinter] Error when closing the main window with destroy TomasSanchexx 1 728 Aug-06-2023, 01:54 AM
Last Post: deanhystad

Forum Jump:

User Panel Messages

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