data hiding for python QTconsole

孤街浪徒 提交于 2019-12-07 16:23:34

问题


Currently I am making an image authentication project in which I need to authenticate an image with the help of a key. I am taking the key as a raw_input from the user through the IPython console. I want to hide the key being entered.

Expected Result:

Enter the key = ***** or Enter the key = (nothing shown)

I found getpass() method for hiding the entered data but it gives the following warning on my PC: Warning: QtConsole does not support password mode, the text you type will be visible.

I even saw this code:

import sys
import msvcrt

passwor = ''
while True:
    x = msvcrt.getch()
    if x == '\r':
        break
    sys.stdout.write('*')
    passwor +=x

print '\n'+passwor

But this prints infinite number of asterisks on the display.

Please let me know some solution for this problem.

来源:https://stackoverflow.com/questions/45814910/data-hiding-for-python-qtconsole

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!