Questions tagged [curses]

Curses is a library for unix-ish computers that you can use to have better and more interactive consoles, including colors. It is used in some console games, like the original Rogue.

Curses is a library for unix-ish computers that you can use to have better and more interactive consoles, including colors. It is used in some console games, like the original Rogue.

See also: -

1003 questions
8
votes
2 answers

Why can't I addstr() to last row/col in python curses window?

Using Python, I'm trying to write the cursor location to the lower right corner of my curses window using addstr() but I get an error. ScreenH-2 works fine but is printed on the 2nd line up from the bottom of the winddow. ScreenH-1 does not work at…
wufoo
  • 13,571
  • 12
  • 53
  • 78
8
votes
1 answer

How to detect curses ALT + key combinations in python

New to python here and using the curses import. I want to detect key combinations like ALT+F and similar. Currently, I am using getch() to receive a key and then printing it in a curses window. The value does not change for F or ALT+F. How can I…
wufoo
  • 13,571
  • 12
  • 53
  • 78
8
votes
6 answers

How can I screen-scrape output from telnet in Perl?

I can setup a telnet connection in Perl no problems, and have just discovered Curses, and am wondering if I can use the two together to scrape the output from the telnet session. I can view on a row, column basis the contents of STDOUT using the…
Mike Atkinson
  • 105
  • 1
  • 7
8
votes
3 answers

what is the key code for space bar in curses.h

I just have a simple question, I cannot find what the key code is for space bar in curses.h. ex. I know the code for down is KEY_DOWN. can anyone help?
wenincode
  • 376
  • 5
  • 10
  • 20
7
votes
1 answer

Ruby curses colors

How can I get colors with Ruby's default Curses library? So something like: puts "\e[0m\e[30;47mtest\e[0m" works great. Gives a nice black on light gray background. But this: #!/usr/bin/env ruby require 'curses' Curses.noecho # do not show typed…
Aleksandr Levchuk
  • 3,751
  • 4
  • 35
  • 47
7
votes
0 answers

Curses - endwin is resetting to original terminal size after the terminal has been resized

I have a Curses application that is running ok. It handles resizing the term well and everything draws ok. The only problem is that when endwin() is called it resets the terminal to the original size. IE, I'm using the application, I resize my term,…
Brayton
  • 71
  • 1
7
votes
0 answers

Remove delay after first symbol on key hold

When I press and hold a key, a first symbol is typed, then there is a little delay, and then other symbols are typed fast. Something like this: Same happens in Terminal. Same happens in linux console (tty), even though this delay is smaller…
Highstaker
  • 1,015
  • 2
  • 12
  • 28
7
votes
4 answers

Urwid: make cursor invisible

I'm using urwid, which is a Python "framework" for designing terminal user interfaces in ncurses. There's one thing though that I'm not able to do in urwid that was easy in curses - make the cursor invisible. As it is now, the cursor is visible when…
makos
  • 157
  • 3
  • 14
7
votes
1 answer

Where do stdout and stderr go when in curses mode?

Where do stdout and stderr go when curses is active? import curses, sys def test_streams(): print "stdout" print >>sys.stderr, "stderr" def curses_mode(stdscr): test_streams() test_streams() curses.wrapper(curses_mode) Actual output…
Matt Joiner
  • 112,946
  • 110
  • 377
  • 526
7
votes
4 answers

How to get a brightwhite color in ncurses?

How to init a color pair with light grey background, and bright white foregraound? init_pair(number, COLOR_WHITE, COLOR_WHITE) creates a color pair with light grey foreground and backround, but I need foreground to be really white. I tried combining…
dahpgjgamgan
  • 2,977
  • 4
  • 25
  • 26
7
votes
4 answers

Outputting unicode characters in windows terminal

Over the past week I've been working on a roguelike game in C++ along with a friend. Mostly too learn the language. I'm using: pdcurses Windows 7 Visual studio C++ To output wchar_t's wherever I want to in the console. I have succeeded in…
Martin Nycander
  • 1,309
  • 13
  • 29
7
votes
3 answers

nodelay() causes python curses program to exit

I've written a curses program in python. It runs fine. However, when I use nodelay(), the program exits straight away after starting in the terminal, with nothing shown at all (just a new prompt). EDIT This code will reproduce the bug: sc =…
ACarter
  • 5,688
  • 9
  • 39
  • 56
6
votes
1 answer

Python curses.getmouse()

#!/usr/bin/env python # -*- coding: utf-8 -*- import curses screen = curses.initscr() curses.noecho() curses.curs_set(0) screen.keypad(1) curses.mousemask(1) screen.addstr("This is a Sample Curses Script\n\n") while True: event =…
good_evening
  • 21,085
  • 65
  • 193
  • 298
6
votes
1 answer

How do console graphics work? (less, curses, vi...)

Can someone explain to me how less, vi and curses programs manage graphics output? Can they change individual characters on the screen or do they have to literary clear and redraw the screen whenever something changes? It would be really neat if…
futlib
  • 8,258
  • 13
  • 40
  • 55
6
votes
1 answer

Python curses, splitting terminal window in 4 pads - prefresh() returned ERR

I'm running a multiprocessing system in Python, and I was planning to use curses to divide the terminal window in 4 quadrants, and display the output of each of the processes in one of them. So, the final output should look something…
Carlo
  • 1,321
  • 12
  • 37