Question: I have the following program that takes the input from the user and then shows it in GUI but I need to store the input
I have the following program that takes the input from the user and then shows it in GUI
but I need to store the input in a variable and use it later after closing the GUI in another part of the code
from tkinter import *
ws = Tk() ws.title("PythonGuides") ws.geometry('400x300') ws['bg'] = '#ffbf00'
def printValue(): pname = player_name.get() Label(ws, text=f'{pname}, Registered!', pady=20, bg='#ffbf00').pack()
player_name = Entry(ws) player_name.pack(pady=30)
Button( ws, text="Register Player", padx=10, pady=5, command=printValue ).pack()
ws.mainloop()
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
