Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 26 lines (22 sloc) 0.577 kb
3093072 @zdennis added examples to how you can use getnstr, noecho and echo to ask a user...
authored
1 require 'ncurses'
2
3 begin
4 window = Ncurses.initscr
5 Ncurses.cbreak
6
7 # This example asks for your name and password, and
8 # correctly hides the password
9
10 name, password = "", ""
11 window.mvprintw(3, 10, "Enter your name: ")
12 window.refresh
13 window.getnstr(name, 45)
14 window.mvprintw(5, 10, "Enter your password: ")
15 window.refresh
16 Ncurses.noecho
17 window.getnstr(password, 8)
18 Ncurses.echo
19
20 window.mvprintw(7, 10, "Your name is %s", name)
21 window.mvprintw(8, 10, "Your password is %s", password)
22 window.refresh
23 window.getch
24 ensure
25 Ncurses.endwin
26 end
Something went wrong with that request. Please try again.