Tkinter Wiki   PasswordDialog UserPreferences
 
HelpContents FindPage Diffs Info Edit Subscribe XML Print View

PasswordDialog here is similar to the Pmw widget ?PromptDialog, but this version includes a field for login ID as well as password.

The following code shows how to draw a PasswordDialog, and execute some command, but it doesn't show how to obtain the actual login and password information.

  1 
  2 
  3 
  4 
  5 
  6 
  7 
  8 
  9 
 10 
 11 
 12 
 13 
from Tkinter import *
from bwidget import *
t = Tk()
t.title('password')
def printMe(s):
        print s

b = Button(t, relief=LINK, text="Quit", command=t.destroy)
b.pack()

p = PasswordDialog(t, type="okcancel", labelwidth=10,
                command=lambda s='have pwd': printMe(s))
t.mainloop()

Screenshot:

bwPassword2.png

PythonPowered