Python Tkinter - How To Hide And Show Password Using Tkinter Python

Python - How To Hide And Display Password Text In Tkinter Python

How To Hide And Show Password Using Tkinter Python


import tkinter as tk
from tkinter import *
from tkinter import ttk


root = Tk()
frame = tk.Frame(root, bg='#ddd')


label_pass = tk.Label(frame, text='Password:', font=('verdana',14), bg='#ddd')
entry_pass = tk.Entry(frame, font=('verdana',14), show='*')

def show_and_hide():
if entry_pass['show'] == '*':
entry_pass['show'] = ''
else:
entry_pass['show'] = '*'
checkBox_showPassword = Checkbutton(frame, text="show", bg='#ddd',fg='red',
font=('verdana',14), command=show_and_hide)

frame.grid(row=0, column=0)

label_pass.grid(row=0, column=0, padx=(10,0), pady=10, sticky='e')
entry_pass.grid(row=0, column=1, padx=(0,10), pady=10)
checkBox_showPassword.grid(row=1, column=1, padx=0, pady=0, sticky='w')


root.mainloop()


OUTPUT:

How To Hide And Display Password Text In Tkinter Python
How To Hide Password Text In Tkinter Python

How To Display And Hide Password Text In Tkinter Python
How To Display Password Text In Tkinter Python






Share this

Related Posts

Previous
Next Post »