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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!