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
9
votes
3 answers

What is the recommended way to implement text scrolling in ncurses?

I am trying to implement an ncurses app with text scrolling like less. What is the recommended way to do this? Here's what I know: You can use scroll to move the text buffer up or down by 1 row. However, you'll end up with one blank line at the…
airportyh
  • 21,948
  • 13
  • 58
  • 72
9
votes
1 answer

How does getmaxyx work? (from curses)

I'm confused on how the "function" getmaxyx works... because I know it's actually a macro. But how does this macro work? Code example: #include int main() { int col, row; initscr(); getmaxyx(stdscr,row,col); endwin(); return…
9
votes
1 answer

How do you get the last arrow key pressed using curses?

I'm writing a Python snake game using curses, but am having some trouble controlling the snake, my current code for controlling the snake is placed inside the main loop and looks like this: while True: char = screen.getch() if char == 113:…
Zaz
  • 46,476
  • 14
  • 84
  • 101
9
votes
3 answers

how to delete text to end of line with curses

How how to delete text to end of line ? stdscr.addstr(5, 5, "Egestas Curabitur Phasellus magnis") result screen: Egestas Curabitur Phasellus magnis # OK stdscr.addstr(5, 5, "Elit metus") result screen: Elit metusrabitur Phasellus magnis # Problem
Ing Dedek
  • 153
  • 2
  • 7
9
votes
3 answers

curses library: why does getch() clear my screen?

I'm trying to learn the curses library (pdcurses, as I'm in Windows OS), with C++. I have a program that displays 3 windows, then a while loop to do some processing based in key presses captured by getch(). The loop gets exited when the F1 key is…
user2948911
  • 113
  • 1
  • 4
9
votes
1 answer

C - Curses, remove blinking cursor from game

Hi I'm doing an assignment in C in Unix and the task is to make a simple pong game. I've got the game working now except there is one annoying part, there is a blinking cursor directly behind the paddle constantly. How do I turn this off? Here is a…
user2661167
  • 491
  • 5
  • 13
  • 22
9
votes
1 answer

Curses Difference between newwin and subwin

i don't seem to be able to find any informations about the difference between curses.newwin and curses.subwin do you know any? i'd like to have a screen divided in 3 different sections with different updates times (not everything must be updated…
Stormsson
  • 1,391
  • 2
  • 16
  • 29
9
votes
1 answer

How do I port this program from conio to curses?

I wrote this simple program on Windows. Since Windows has conio, it worked just fine. #include #include int main() { char input; for(;;) { if(kbhit()) { input = getch(); …
Veselin Romić
  • 703
  • 6
  • 11
8
votes
3 answers

Is there a way to create a separate display and input on the same terminal using curse?

I'd like to code a command line program that result in this UI: ------------ | | | A | |__________| |_____B____| A is a separate process that loops and displays a list of real time events. It self-refresh. B is a command prompt.…
Bite code
  • 578,959
  • 113
  • 301
  • 329
8
votes
4 answers

Xcode and Curses.h with Error opening terminal

I am trying to compile a simple curse project with Xcode. The program compiles fine with g++ in terminal with the flag -lcurses, and runs fine. Started of by creating a Command Line Tool with type c++. imported curses.h into my main. In the…
archieoi
  • 429
  • 1
  • 6
  • 9
8
votes
3 answers

Console interface tutorials and tips (pdcurses)

I'm looking for tutorials on using PDCurses library. Unfortunately there is text only documentation, which is more like function reference. Are pdcurses similar enough to ncurses to use ncurses tutorials??? Any tips for making console UI's ??? PS.…
M_1
  • 2,135
  • 4
  • 21
  • 24
8
votes
1 answer

How to intercept special (alt / ctrl) key press?

How can I catch key combinations like ALT+K or CTRL+ALT+H in python curses?
pistacchio
  • 56,889
  • 107
  • 278
  • 420
8
votes
3 answers

ncurses and white-on-black

I can't seem to get white-on-black to work in curses when in color mode. If I don't call start_color, I get white-on-black. As soon as I call start_color, things start outputting in grey-on-black. If you run this script: import sys for i in…
Thanatos
  • 42,585
  • 14
  • 91
  • 146
8
votes
2 answers

Python input single character without enter

What I am trying to do is make a simple pi memorization game in Python. What I need is a way to get input from the user without having to press 'enter' after every character. It sounds like I need something like getch, but I can't get it to work. …
ArgoLake
  • 81
  • 1
  • 1
  • 3
8
votes
3 answers

Python's curses module does not refresh pad until first character received

I have the following code that allows you to scroll up and down a pad of text. Each time you scroll (i.e. handle a user input) the pad updates as expected. However, before the first key is pressed nothing is shown, despite that I'm calling…
felix001
  • 15,341
  • 32
  • 94
  • 121