I'm trying to get a tkinter window to ask for a team name then to save it as a variable, this is what I have so far...
import tkinter
def new_game_func():
def save():
print('Saving team')
print(E1)
team=0
while team<=4:
team=team+1
newgamew=tkinter.Tk()
label1 = tkinter.Label(newgamew, text="Team name:")
E1 = tkinter.Entry(newgamew, bd =5)
submit = tkinter.Button(newgamew, text ="Submit", command=save)
label1.pack()
E1.pack()
submit.pack()
newgamew.mainloop()
team()
new_game_func()
All it displays is:
Saving team
.20237872
How would I save it as plain text and not a bunch of numbers?!?!
E1
is the reference for your Entry
. If you wish to access the text within the Entry
, you can use E1.get()
.