
Today we are going to discuss how can we create a simple login application using tkinter in Python in which password values will be hidden from the user
Source Code
# importing tkinter from tkinter import * # initializing root root = Tk() # setting geometry root.geometry("400x300") # defining function to print username and password on call def showinfo(): print("User Name is", user_name.get()) print("Password is", password.get()) # defining function to clear entry widgets using .set() method def clear(): user_name.set("") password.set("") user_name = StringVar() # User name variable password = StringVar() # Password variable # creating an entry widget to take username user_name_Entry = Entry(root, textvariable=user_name).pack(pady=10) # creating an entry widget to take userpassword passEntry = Entry(root, textvariable=password, show='*').pack(pady=10) # creating a button to call "showinfo" function which will print # username and password in console Button(root, text='Show Info', command=showinfo).pack(pady=10) # creating a button to call "clear" function which will clear the entry # widgets value of username and userpassword Button(root, text='Clear Info', command=clear).pack(pady=10) # .mainloop() is used when our program is ready to run root.mainloop()
Output
On Running

On Entering Values

On Clicking the “Show Info” Button

Run Python Code:
Thanks for Reading
Keep Updated for more amazing content like this
Also read:
- ChatGPT vs DeepSeek: Who is the winner?Here’s a detailed comparison between ChatGPT (specifically GPT-4o) and DeepSeek-V3 based on various online resources, focusing on key metrics such as time to build, cost, performance, and other relevant factors: 1. Architecture and Model Size 2. Training Cost and Efficiency 3. Performance Benchmarks 4. Cost of Usage 5. Open-Source and Accessibility 6. Real-World Applications 7….
- People are becoming AI Engineer with this free course in 2025: Here is how to join this…Artificial Intelligence (AI) has become a cornerstone of technological advancement, shaping industries and transforming careers. If you’ve been looking to upskill or dive into the fascinating world of AI, freeCodeCamp.org has released an incredible resource: the AI Foundations Course on YouTube. This 11-hour video, created by @LunarTech_ai, is not just another crash course – it’s…
- Apply to Google’s Student Training in Engineering Program (STEP) Intern, 2025Google’s Student Training in Engineering Program (STEP) Intern, 2025, is a fantastic opportunity for students passionate about programming and software development. Designed to support skill-building and career growth, this program offers a chance to work with one of the world’s leading tech companies. Here’s everything you need to know about this internship opportunity. What Is…
- Self-Driving Car Saves Falling Pedestrian, Showcases Promise of Autonomous TechnologyIn a dramatic demonstration of the potential for self-driving technology to enhance road safety, a Waymo’s autonomous vehicle recently avoided a serious accident when a scooter rider, startled by a pothole, lost balance and fell onto the road. The incident, captured on video, highlights the advanced capabilities of modern driverless technology. As the rider tumbled…
- Instant Karma: Employer Fires Tech Team with AI, Faces Backlash on LinkedIn While Seeking New DevelopersIn a bold—and controversial—move, Canadian software developer Wes Winder has sparked heated online debates after replacing his entire development team with Artificial Intelligence (AI). Winder, who took to LinkedIn to announce his decision, has been met with a wave of criticism and ridicule, with many questioning the practicality and ethics of his approach. The Controversial…