Took me abit of googling to find out a keys.BACKSPACE exist but here we go:
from getkey import getkey,keys
from replit import clear
#Fake password
list_1 = []
options = ['PassWord: ','Show Password','Hide password']
#Real password
list_2 = []
list_3 = list_1
def Sign_In(menu):
global list_1,list_2,cnt,key,list_3,opt,Hello,opt_2,temp_var
opt_2 = ''
Hello = False
opt = ''
selection = 0
cnt = 0
key = ''
while True:
if key == keys.ENTER:
if opt == 'PassWord: ':
break
clear()
print('------------------------------------')
print(' Sign In!')
print('')
for i in range(len(menu)):
opt = menu[i]
if i == selection:
if opt == 'PassWord: ':
opt_2 = "".join(list_2)
if Hello == True:
print(f'> {opt}{opt_2}')
else:
opt_2 = ''.join(list_1)
print(f'> {opt}{opt_2}')
else:
print(f'> {opt}')
else:
if opt == 'PassWord: ':
if Hello == True:
print(f' {opt}{"".join(list_2)}')
else:
print(f' {opt}{"".join(list_1)}')
else:
print(f' {opt}')
key = getkey()
string = key
if key == keys.UP:
selection = (selection - 1) % len(menu)
if selection == -1:
selection = (selection + len(menu)+1) % len(menu)
elif key==keys.DOWN:
selection = (selection + 1) % len(menu)
if selection > len(menu):
selection = (selection - len(menu)-1) % len(menu)
if key == keys.UP or key == keys.DOWN:
pass
else:
if key == keys.ENTER and selection == 0:
clear()
print('Signed in!')
break
elif key == keys.ENTER and selection == 1:
list_3 = list_2
Hello = True
elif key == keys.ENTER and selection == 2:
list_3 = list_1
Hello = False
if selection == 0:
if key == keys.BACKSPACE:
temp_var = list_1.pop(-1)
temp_var = list_2.pop(-1)
else:
list_1+='*'
list_2+=string
Sign_In(options)
I would not say its too hard to make it lol