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
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.title("Root Window")
    def open_popup(num):
    popup = Toplevel()
    value = Entry(popup), width=25, x=100, y=10)
    value.insert(0, str(num))
    btn_ok = Button(popup, text="Return", command=popup.destroy), width=60, x=90, y=45)
    main_entry = Entry(root), width=30, x=110, y=10)
    main_entry.insert(0, "111")
    button_ok = Button(
    root, text="OK", command=lambda: open_popup(main_entry.get())), width=30, x=110, y=45)

Possibly Related Threads…
Thread Author Replies Views Last Post
  [PyQt] Opening new window ifigazsi 2 74 Jan-20-2021, 04:16 PM
Last Post: ifigazsi
  Entry Widget issue PA3040 16 1,482 Jan-20-2021, 02:21 PM
Last Post: pitterbrayn
Question closing a "nested" window with a button in PySimpleGUI and repeating this process Robby_PY 9 442 Jan-18-2021, 10:21 PM
Last Post: Serafim
  Trying to make random image loop in Tk window using python Jediguy18 1 189 Dec-30-2020, 04:56 AM
Last Post: deanhystad
  [Tkinter] Entry returns NONE mollerpunker 2 192 Dec-06-2020, 06:50 PM
Last Post: DT2000
  function in new window (tkinter) Dale22 7 358 Nov-24-2020, 11:28 PM
Last Post: Dale22
  Displaying various layouts in a single window arbiel 6 1,353 Nov-08-2020, 09:21 PM
Last Post: arbiel
  [Tkinter] On Win 10, no graphical window when run code ma2020uk 10 465 Nov-02-2020, 02:21 PM
Last Post: Larz60+
  [Tkinter] Entry problem DPaul 5 260 Oct-29-2020, 05:38 PM
Last Post: deanhystad
  Entry Validation in tkinter shahulvk 4 314 Oct-28-2020, 10:12 PM
Last Post: joe_momma

Forum Jump:

User Panel Messages

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