0

I am trying to create a input box as shown below. For this reason, I have wrote below code but whenever I press enter key, it should not take any word, lke whenever you press enter key on the username input box it will swtich to the password input box. But, I have not found how I can make the input box s sensible to enter key. How can I do ?

import curses
import curses.textpad

stdscr = curses.initscr()
curses.noecho()
curses.cbreak()
stdscr.keypad(1)

stdscr.clear()
stdscr.refresh()
win = curses.newwin(5, 20, 5, 10)
tb = curses.textpad.Textbox(win)
text = tb.edit()




visualization :

   |-----------------------------|
   |                             |
   |       |------|              | // input box for taking username
   |       |------|              |
   |                             |
   |-----------------------------|
Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343
demilg
  • 77
  • 6

1 Answers1

0

Maybe use getstr() instead of textpad? That way you can just make a simple continuation on the input you get.

use subwin (with curses.panel?) and ask for the username input. When the program gets the input it directly asks for password.

sousys
  • 51
  • 6