Skip to content

Instantly share code, notes, and snippets.

@pricees
Created November 25, 2012 20:27
Show Gist options
  • Select an option

  • Save pricees/4145198 to your computer and use it in GitHub Desktop.

Select an option

Save pricees/4145198 to your computer and use it in GitHub Desktop.
Curses, Part 2-2: Window fun!
#!/usr/local/bin/ruby
require "curses"
begin
Curses.init_screen # bring it
line = ""
str = "Enter a string ('quit' to quit):"
win = Curses::Window.new(5, 50, 10, 10)
begin
win.clear
win.box("|", "-")
win.setpos(1, 3)
win.addstr(line)
win.setpos(2, 3)
win.addstr(str)
win.setpos(3, 3)
win.refresh
end while (line = win.getstr) != "quit"
win.close
ensure
Curses.close_screen
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment