I am trying to design a GUI for a bit of fun. the purpose of the code is to take what you entered into a "entry widget" and print it out in the terminal using the print() command when you press the submit button.
One: i keep getting an "Invalid syntax" error in the code both the root.geometry() and root.mainloop()
two: is there a more effective way of getting the text from a tkinter entry widget and storing it in a variable. i would like to be able to store data from multiple entry widgets to multiple variables, and how can i do that.
Here is my full code.
from tkinter import * root = Tk() def get_input(): val = e1.get("1.0", "end-1-c") print(val) lbl1 = Label(root, text = "Enter your name:").grid(row= "0", column= "0") e1 = Entry(root, borderwidth = 5, width = 20).grid(row = "0", column = "1") sbut = Button(root, text = "submit", command = get_input.grid(row= "1", column = "0") root.geometry("300x300") root.mainloop()
i used https://www.youtube.com/watch?v=FueIPFqRyyY&t=85s for the code to save entry widget data to a varible
Thanks for any help 😊