ctw6av
(usa Nenhuma)
Enviado em 18/02/2017 - 19:09h
Eu tenho um rascunho disso aqui mas vc terá que alterar para deixar do seu jeito. Está auto explicativo bastando só vc conhecer a lib curses, segue:
#!/usr/bin/env python3
import curses
class MainScreen(object):
def __init__(self):
# Inicia a janela
self.stdscr = curses.initscr()
self.stdscr.keypad(True)
# Opções da janela
curses.curs_set(False)
curses.echo()
def get_login(self):
password = ''
username = ''
while True:
self.stdscr.addstr('Username: ' + username)
self.stdscr.refresh()
char = self.stdscr.getkey()
if char != '\n':
self.stdscr.clear()
username += char
continue
self.stdscr.clear()
break
while True:
self.stdscr.addstr('Username: {}\n'.format(username))
self.stdscr.addstr('Password: {}'.format('*' * len(password)))
self.stdscr.refresh()
char = self.stdscr.getkey()
if char != '\n':
self.stdscr.clear()
password += char
continue
break
self.stdscr.clear()
self.stdscr.addstr('Username: {}\n'.format(username))
self.stdscr.addstr('Password: {}\n\n'.format(password))
self.stdscr.refresh()
self.stdscr.addstr('\nHit any key to end the win...')
self.stdscr.getch()
if __name__ == '__main__':
window = MainScreen()
try:
curses.wrapper(window.get_login())
except KeyboardInterrupt:
curses.endwin()
______________________________________________________________________
OS: Biebian
Kernel: x86_64 3.5.2-amd64
Resolution: 1320x768
CPU: Intel Core i3-4005U CPU @ 1.7GHz
RAM: 3852MiB
Distro:
http://biebian.sourceforge.net/