Bottom Page

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)

Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  [Tkinter] bad window path name jdos 6 186 Jun-25-2020, 06:25 AM
Last Post: jdos
  [Tkinter] How to show text in window? wxnerd 4 152 Jun-20-2020, 04:16 PM
Last Post: wxnerd
  Create image on a Toplevel using tkinter ViktorWong 3 913 Jun-13-2020, 03:21 PM
Last Post: deanhystad
  [Tkinter] Locking Canvas to a Window drnshaw 4 203 Jun-06-2020, 03:15 PM
Last Post: drnshaw
  [Tkinter] Auto re-fit frames sizes in main window Gilush 2 119 Jun-06-2020, 03:14 AM
Last Post: Gilush
  [Tkinter] Getting Input from Tkinter Entry juliabrushett 6 11,578 May-30-2020, 03:29 PM
Last Post: Larz60+
  [Tkinter] Is it the right way to create a second window? aquerci 3 350 May-19-2020, 07:22 AM
Last Post: aquerci
  Disable entry field and still see value scratchmyhead 5 178 May-11-2020, 08:09 PM
Last Post: menator01
  Converting Entry field value to integer in tkinter scratchmyhead 2 147 May-11-2020, 03:41 PM
Last Post: scratchmyhead
  [Tkinter] How to make message box error stay on top of window scratchmyhead 1 161 May-10-2020, 10:21 PM
Last Post: scratchmyhead

Forum Jump:

Users browsing this thread: 1 Guest(s)