I want to know how to get the text from a Tkinter entry box. I made the UI with this website: https://visualtk.com. But now I dont know how to obtain the entered text. I paste my script here:
import tkinter as tk
import tkinter.font as tkFont
class App:
def __init__(self, root):
#setting title
root.title("Login")
#setting window size
width=497
height=214
screenwidth = root.winfo_screenwidth()
screenheight = root.winfo_screenheight()
alignstr = '%dx%d+%d+%d' % (width, height, (screenwidth - width) / 2, (screenheight - height) / 2)
root.geometry(alignstr)
root.resizable(width=False, height=False)
GLabel_129=tk.Label(root)
GLabel_129["bg"] = "#ff8c00"
ft = tkFont.Font(family='Times',size=28)
GLabel_129["font"] = ft
GLabel_129["fg"] = "#ffffff"
GLabel_129["justify"] = "left"
GLabel_129["text"] = "Login:"
GLabel_129.place(x=0,y=10,width=497,height=66)
GLabel_333=tk.Label(root)
GLabel_333["bg"] = "#1e9fff"
ft = tkFont.Font(family='Times',size=10)
GLabel_333["font"] = ft
GLabel_333["fg"] = "#01aaed"
GLabel_333["justify"] = "center"
GLabel_333["text"] = ""
GLabel_333.place(x=0,y=80,width=497,height=15)
GLineEdit_552=tk.Entry(root)
GLineEdit_552["borderwidth"] = "1px"
ft = tkFont.Font(family='Times',size=14)
GLineEdit_552["font"] = ft
GLineEdit_552["fg"] = "#333333"
GLineEdit_552["justify"] = "left"
GLineEdit_552["text"] = ""
GLineEdit_552.place(x=110,y=100,width=375,height=32)
GLineEdit_314=tk.Entry(root)
GLineEdit_314["borderwidth"] = "1px"
ft = tkFont.Font(family='Times',size=14)
GLineEdit_314["font"] = ft
GLineEdit_314["fg"] = "#333333"
GLineEdit_314["justify"] = "left"
GLineEdit_314["text"] = ""
GLineEdit_314.place(x=110,y=140,width=375,height=32)
GLineEdit_314["show"] = "*"
GLabel_702=tk.Label(root)
ft = tkFont.Font(family='Times',size=14)
GLabel_702["font"] = ft
GLabel_702["fg"] = "#ff0000"
GLabel_702["justify"] = "left"
GLabel_702["text"] = "Username:"
GLabel_702.place(x=10,y=100,width=100,height=32)
GLabel_648=tk.Label(root)
ft = tkFont.Font(family='Times',size=14)
GLabel_648["font"] = ft
GLabel_648["fg"] = "#ff0000"
GLabel_648["justify"] = "left"
GLabel_648["text"] = "Password:"
GLabel_648.place(x=10,y=140,width=100,height=32)
if __name__ == "__main__":
root = tk.Tk()
app = App(root)
root.mainloop()
Is there any command or function to get the text? Or do I need to have a button to enter the text?