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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started