How would I manipulate an entry widget so that it hides the entered characters behind asterisks? like this:
Typed: PassWord
Displayed as typing occurs: ********
I'm trying to make a dialog box module, for use in some future programs. I want the user to be the only one to know what he is typing in case of eavesdroppers reading over the shoulder as it is entered. Here's the current code, to make the box:
# file: MyPassBox.py
loginId={}
#import modules:
from Tkinter import *
#define main window
class main:
def __init__(self, master):
self.master = root
self.master.title('Username and Password?')
self.master.geometry('300x100+300+450')
self.master.labelUser = Label(self.master, text = 'Username?')
self.master.labelUser.grid(row=0, column=0)
self.master.entryUser = Entry(self.master)
self.master.entryUser.grid(row=0, column=1)
self.master.labelPass = Label(self.master, text = 'Password?')
self.master.labelPass.grid(row=1, column=0)
self.master.entryPass = Entry(self.master)
self.master.entryPass.grid(row=1, column=1)
self.button_OK=Button(self.master, text='Submit', command=self.submit)
self.button_OK.grid(row=2, column=0)
self.button_cancel=Button(self.master, text='Cancel', command=self.cancel)
self.button_cancel.grid(row=2, column=3)
self.master.mainloop()
def submit(self):
print 'submit'
def cancel(self):
self.master.destroy()
root = Tk()
main(root)
Can you help me?