
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:
- Artificial Intelligence Showdown: Weighing OpenAI Against Mistral CapabilitiesOverview As a developer using Python, choosing the right model for your project can be a daunting task. Two popular models that have gained significant attention in recent years are OpenAI GPT and Mistral. In this article, we will compare and contrast these two models, highlighting their strengths, weaknesses, and use cases to help you…
- Codex Security enters experimental phase for testing and evaluation purposesCodex, the AI model developed by Microsoft, has made significant strides in recent times. The latest development in this space is the introduction of Codex Security, which is now available in research preview. This announcement has the potential to greatly impact the way developers approach AI-powered applications, particularly in terms of security and reliability. What…
- How Balyasny Asset Management built an AI research engine for investingBalyasny Asset Management has developed an AI research engine for investing, marking a significant advancement in the use of artificial intelligence in finance. This engine is designed to improve investment decisions by analyzing vast amounts of data and identifying patterns that may not be apparent to human researchers. For more information, visit the source to…
- Why All AI Models Are Slowly Becoming the Same Model
Artificial Intelligence has progressed at an astonishing speed over the last few years. In a short period of time, the world moved from simple chatbots and rule-based systems to powerful language models capable of writing code, solving complex problems, and assisting in research. At first glance, it appears that many different companies are building very… - Aam Aadmi vs Corrupt System: How ChatGPT Helped One Guy Expose Govt Fraud, The Story: “Ravi and The Missing Light Pole”
Ravi was just a normal guy from a small town in Uttar Pradesh. He worked in a private IT support company, nothing fancy, and earned enough to keep his home running. He lived in a street that had one big problem. The street was dark. No street light. At night, people were scared to walk….




