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] Received RunTimeError after script concludes, closing Dialog Window (clicking x-out) skipper0802 0 120 Oct-09-2020, 09:23 PM
Last Post: skipper0802
  [Tkinter] password with Entry widget TAREKYANGUI 9 353 Sep-24-2020, 05:27 PM
  Scrollable big image in a window (TKinter) Prospekteur 3 187 Sep-14-2020, 03:06 AM
Last Post: Larz60+
  Run more than one window together with tkinter SmukasPlays 1 191 Aug-24-2020, 05:00 PM
Last Post: Larz60+
  Adding an image to a tkinter window djwilson0495 2 486 Aug-23-2020, 11:07 AM
Last Post: ebolisa
  Get selected text inside an Entry Jerdup 0 170 Aug-20-2020, 12:42 PM
Last Post: Jerdup
  How to check if window is fullscreen or not delphinis 2 267 Aug-01-2020, 01:21 PM
Last Post: delphinis
  [Tkinter] calling a new window from a tkinter window neuroprogrammer 2 276 Jul-28-2020, 10:59 PM
Last Post: deanhystad
  How to display results from terminal window onto tkinter. buttercup 0 185 Jul-21-2020, 04:41 AM
Last Post: buttercup
  how to add elements in the other window? (pysimplegui) syafiq14 0 216 Jul-20-2020, 10:35 PM
Last Post: syafiq14

Forum Jump:

User Panel Messages

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