So, what is my deal...
I'm working on a script, which, at some point will require the user to insert his or hers username and a password. My question is, how can I make that when the user will write in the password box/line whatever, instead of its characters, to be shown this character, the Asterix (*), as on all other web-sites, or programs which use log in boxes?...
Is there a way, well, to write with no echoo (like in assembly for those who understand), meaning to change the strings which are entered from the keyboard with ***?
If some1 has any ideas, please, feel free to post here.:D
10x alot.

Recommended Answers

All 3 Replies

A Tkinter Entry widget can be configured to "show" a character such as "*".

Tkinter.Entry(pwframe,width=25,show="*")

Using the Tkinter GUI toolkit that comes with Python you can use the password option this way:

# Tkinter, explore the entry field for passwords! 

from Tkinter import *

def showme():
    # clear the label
    label2.config(text='')
    # get the enter1 text and display in label
    label2.config(text=enter1.get())

root = Tk()

# create a data entry widget
enter1 = Entry(root)
# forces Entry to echo as char "*"
enter1["show"] = "*"

# create a label widgets
label1 = Label(root, text='Type password here:')
label1.pack(side='top', fill=X)   # topmost
# start enter1 empty
enter1.insert(0, '')
enter1.pack(side='top', fill=X)   # below label1

label2 = Label(root)
label2.pack(side='top', fill=X)   # below entry1

# cursor in enter1 field
enter1.focus()
# get entry text on Enter-key
enter1.bind('<Return>', (lambda event: showme()))
# or get entry text clicking on button
btn1 = Button(root, text='Get Text', command=showme)
btn1.pack(side='left')

root.mainloop()

10x for your reply, I'll get to it

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.