import tkinter as tk
def on_submit():
value = entry.get()
label.config(text="You entered: " + value)
# Create the main window
root = tk.Tk()
root.title("Entry Example")
# Create an Entry widget with a password field
entry = tk.Entry(root, width=30, show="*", bg="lightgrey", fg="black", font=("Helvetica", 12), bd=2, relief=tk.SOLID)
entry.pack(pady=10)
# Create a button to submit the entry
submit_btn = tk.Button(root, text="Submit", command=on_submit, bg="blue", fg="white", font=("Helvetica", 12), padx=10, pady=5)
submit_btn.pack()
# Create a label to display the entered value
label = tk.Label(root, text="", bg="white", fg="black", font=("Helvetica", 12))
label.pack(pady=10)
# Run the Tkinter event loop
root.mainloop()
Comments
Post a Comment