Simplest method of asking user for password using graphical dialog in Python?
问题 I'm developing a backup daemon that will run silently in the background. The daemon relies on the duplicity backup software, which when backing up requires an encryption key. I cannot ask for the password through the console because obviously, the daemon has no access to such. How could I easily create a prompt that asks the user to type in a password, and returns it to the application (through a Python variable)? I'm using Python 2.7 . 回答1: from Tkinter import * def getpwd(): password = ''