Please help me, because this is for a project and it's very important!!!
-Python version used:Python 3.12.5-
I need to get the user input of those fields(run the code) into a .txt file. Please make it simple. Thanks in advance for those helping!
-Python version used:Python 3.12.5-
import tkinter as tk
def clear_form():
name_entry.delete(0, tk.END)
email_entry.delete(0, tk.END)
contact_entry.delete(0, tk.END)
age_entry.delete(0, tk.END)
gender_menu.set("Gender")
course_menu.set("Select a course")
window = tk.Tk()
window.title("Registration Form")
name_entry = tk.Entry(window)
name_entry.grid(row=0, column=1)
tk.Label(window, text="Name:").grid(row=0, column=0)
email_entry = tk.Entry(window)
email_entry.grid(row=1, column=1)
tk.Label(window, text="Email:").grid(row=1, column=0)
contact_entry = tk.Entry(window)
contact_entry.grid(row=2, column=1)
tk.Label(window, text="Contact:").grid(row=2, column=0)
age_entry = tk.Entry(window)
age_entry.grid(row=3, column=1)
tk.Label(window, text="Age:").grid(row=3, column=0)
gender_menu = tk.StringVar(window)
gender_menu.set("Gender")
tk.OptionMenu(window, gender_menu, "Male", "Female").grid(row=4, column=0, columnspan=2)
course_menu = tk.StringVar(window)
course_menu.set("Select a course")
tk.OptionMenu(window, course_menu, "PY4Y", "PY4Y(Adv)", "AIFF", "Machine Learning").grid(row=5, column=0, columnspan=2)
tk.Button(window, text="Submit").grid(row=6, column=0)
tk.Button(window, text="Clear", command=clear_form).grid(row=6, column=1)
def submit_form():
name = name_entry.get()
email = email_entry.get()
contact = contact_entry.get()
age = age_entry.get()
gender = gender_menu.get()
course = course_menu.get()
window.mainloop()-------------------------------------------------------------------------------------------------------------------------------------------------------------- I need to get the user input of those fields(run the code) into a .txt file. Please make it simple. Thanks in advance for those helping!
