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 "*".


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
    # get the enter1 text and display in label

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
# 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)


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, learning, and sharing knowledge.