Make password input box using Tkinter.

I met python about 5 or 6 years ago, but I have never written a code using Tkinter.
Main reason is that I often call function from CUI or Web UI, so I didn’t need GUI.
But, some days ago, I want to make a plugin that need password box GUI.
So, I searched google and found good solution.
tkSimpleDialog provides simple but sufficient GUI.
Snippet is following.

from __future__ import print_function
import Tkinter, tkSimpleDialog
root = Tkinter.Tk()
# set option show = '*'
# That's all !
pswd = tkSimpleDialog.askstring( title = 'PSWDBOX', prompt='Input pwsd!', show ='*' )

pswd can get user input and input string is masked “*”.


Published by iwatobipen

I'm medicinal chemist in mid size of pharmaceutical company. I love chemoinfo, cording, organic synthesis, my family.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: