I have created a textbox in a tkinter window which is called by a button. I want to get the value of textbox in another window on clicking a button. But when i print the value on console, it prints an empty string instead of the value entered in textbox.
from tkinter import *
def click():
print(id.get())
def submit():
win2=Tk()
Label1=Label(win2,text='Id').pack()
global id
id=StringVar()
textbox=Entry(win2,textvariable=id).pack()
btn2=Button(win2,text='Click',command=click).pack()
win1=Tk()
btn1=Button(win1,text='Submit',command=submit).pack()
Please check my code.