Home > OS >  tkinter widget manipulation
tkinter widget manipulation

Time:10-02

How do I connect the submit button to another "window" so the information entered in tk.Entry() is entered in a specified label on a 2nd "window". I want the "submit" button to be what pulls up the 2nd window "anchored" in the main window from that I will have pointed the information in the entry to the label in the 2nd popup window.


import tkinter as tk

#function that prints the entry
def entry_print(widget):
    name = widget.get()
    print(name)

#Setup for the window
window = tk.Tk()
window.title("Title_Name")
window.geometry("250x250")

#widgets
label = tk.Label(window, text = "Manual:", bg = "dark grey", fg = "white")
entry = tk.Entry()
button = tk.Button(text = "submit",
                   command = lambda e = entry: entry_print(e))

#widget placement
label.place(x=0,y=20)
entry.place(x=52,y=21)
button.place(x=177, y=18)

window.mainloop()

CodePudding user response:

You can create additonal windows via screenshot of it running

  • Related