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
Filter by
Sorted by
Tagged with
2 votes
2 answers
1k views

Correct way to repaint entire screen?

I don't understand what function(s) to use to repaint the screen when the user presses Ctrl-L or Ctrl-R. What's the difference between using clearok(), redrawwin(), or wrefresh() with curscr as ...
potrzebie's user avatar
  • 1,768
4 votes
2 answers
2k views

How curses preserves screen contents?

When you start the (n)curses program, it will remove the scroll bar from your terminal emulator, clear the screen, the scroll log (history) will also disappear. When you exit the program, the screen ...
exebook's user avatar
  • 32.9k
3 votes
1 answer
8k views

output on a new line in python curses

I am using curses module in python to display output in real time by reading a file. The string messages are output to the console using addstr() function but I am not able to achieve printing to a ...
cool77's user avatar
  • 1,106
1 vote
1 answer
2k views

Python curses not accept curses.KEY_UP as input

I need your help in understanding the mistake in my new menu based python program. I have created a menu based python using the curses library. The program works fine with main menu options by ...
Mullai Arasu's user avatar
-1 votes
1 answer
1k views

How should I be going about exiting python script when user types 'q'?

I'm trying to add code to exit my curses python script correctly when the user types q. I can't merely do CTRL+C because then curses won't be de-initialized correctly. I haven't found a good solution ...
minnymauer's user avatar
0 votes
3 answers
278 views

Switch to vim like editor interactivelly to change a Python string

I have the following source code: import sys, os import curses import textwrap if __name__ == "__main__": curses.setupterm() sys.stdout.write(curses.tigetstr('civis')) os.system("clear") str ...
xralf's user avatar
  • 3,534
0 votes
1 answer
2k views

Simple Text GUI (TUI) Using NCurses and C to Display System Info

I am just beginning to toy around with combining ncurses and C to develop a very minimal TUI. The purpose of the TUI is to greet users with a basic login/welcome screen. The goal would be to display ...
Funsaized's user avatar
  • 2,030
2 votes
1 answer
635 views

ncurses and C- Display output of 'df' command in ncurses window

I am relatively new to ncurses and was just wondering what would be the simple way to display the output of a command executed in terminal/the command line in the ncurses TUI that I am starting. i.e ...
Funsaized's user avatar
  • 2,030
1 vote
0 answers
211 views

Running two while loops simultaneously, while sharing state. Asyncio or Queue?

I'm trying to get Python's curses and python-slackclient to work together, but both of them utilize a while loop. I'm new to asynchronous programming and so am having trouble figuring out the best ...
Nick's user avatar
  • 225
-1 votes
2 answers
221 views

Python curses interface

I have developed a program using curses, everything is cool so far but I was wondering myself if there is a good pattern to split different views/panels of my program into smaller chunks callable by ...
Dr I's user avatar
  • 286
3 votes
1 answer
3k views

_curses.error: add_wch() returned an error

I have the following code rendering the display for my roguelike game. It includes rendering the map. def render_all(self): for y in range(self.height): for x in range(self.width): ...
Jonathanb's user avatar
  • 1,254
4 votes
0 answers
2k views

Scala - functions to output to screen/console - clear, position, set color

I am looking for a basic set of functions to be mixed with Scala standard output commands. These commands should: Clear the screen GoTo cursor position X,Y. Change the color of the text. I am in ...
TLOlczyk's user avatar
  • 443
1 vote
0 answers
145 views

Ruby, STDIN, and Curses

I'm trying to take input from STDIN in the same script I'm using curses. It causes ruby to exit immediately and never draw anything with curses on the page. The following works fine: require '...
rbutler's user avatar
  • 11
0 votes
1 answer
117 views

Why is the Windows prompt unresponsive after using a python curses window?

First of all, I'm a newby in python. Had to take a course of it in college and got hooked by its efficiency. I have this sticky problem where the Windows 7 prompt becomes unresponsive after using a ...
R01k's user avatar
  • 735
2 votes
1 answer
242 views

Why is y before x in ncurses functions and arguments?

I've noticed that with most ncurses functions, both in function names and their arguments, y comes before x (getmaxyx(),getparyx(),getyx(), etc), but the opposite is true almost everywhere else. Both ...
eggbertx's user avatar
  • 493
0 votes
1 answer
321 views

ncurses inchstr function not working as intended?

#include <curses.h> #include <fstream> int main(){ initscr(); mvwprintw(stdscr, 1,1, "hello world"); wmove(stdscr, 1,1); chtype* p = 0; int n = 0; n = winchstr(...
Silversonic's user avatar
  • 1,319
2 votes
3 answers
5k views

Is there a list of ANSI color escape codes somewhere in the standard libraries?

I write a lot of little helper scripts, and often these print coloured text in the terminal. For the simplicity of their packaging and distribution, I often want these little scripts to be without ...
wim's user avatar
  • 350k
3 votes
1 answer
65 views

Can't understand these:free immediately after malloc;close file immediately after open

I am reading some source code about an old management tool for bank teller written by c using curses,here are some codes I can't understand: main(int argc, char *argv[]) { int h1, h2; char *...
Tee's user avatar
  • 91
1 vote
1 answer
354 views

C curses doesn't catch mouse event

I am trying to implement a scroll up and down in a curse program, at the moment I am just trying to catch the event and display it's number: MEVENT event; mousemask(ALL_MOUSE_EVENTS, NULL); while (...
Nicolas Scotto Di Perto's user avatar
2 votes
3 answers
954 views

Sending curses input to another terminal in C via a fifo

My C program run multiple thread in the terminal that print messages asynchronously. I'd like a thread to show curses output, but as it is asynchronous it must be in another terminal. My idea is to ...
Nicolas Scotto Di Perto's user avatar
6 votes
1 answer
5k views

Custom RGB colors with Python curses

I'm writing a program in Python using the curses module in the standard library. I want my program to just exit if it can't use custom colors I specify with RGB triples. So I have some starter code ...
math4tots's user avatar
  • 8,752
-1 votes
1 answer
649 views

How to skip a line using curses in Python?

I'm trying to find how to skip a line with curses. I've tried screen.addchr('\n') and screen.addstr("\n") but it didn't work. How can I do that ?
Mickaël B.'s user avatar
0 votes
1 answer
482 views

Node.js/angular wrapper for a vt100 application

I've been searching for a while and I cannot find an answer. I have found node.js terminal emulators but not the other way around. My client uses a vt100 application on a linux box. He does not ...
An Old Guy and His Dog's user avatar
0 votes
0 answers
799 views

How to install curses gem on Windows

How to install curses gem on Windows? I already tried to do everything mentioned in the answers from this question and still got the same error: >E:\software\Ruby22\bin\gem install curses ...
FrozenHeart's user avatar
  • 20.3k
3 votes
1 answer
3k views

Does refresh() need to be called at least once, when using windows in ncurses?

I've been testing ncurses, I tried doing a simple code using windows, by reading the code from the tutorials it seemed to me like calling wrefresh() was enough if changes were made just to one window. ...
santileortiz's user avatar
0 votes
1 answer
3k views

Python curses getting x and y

Okay I am writing a python application using curses and I am trying to center my text in a terminal window from the documentation you can get the x and y using this curses.LINES and curses.COLS I ...
112madgamer's user avatar
1 vote
1 answer
669 views

Python Curses, slow refresh on different consecutive colors

Using python->curses module, I experience a very slow draw/refresh if I chage the string color atribute a lot. I wrote the same program in C++ and had no issue. Code: #!/usr/bin/env python # -*- ...
TBI_RO's user avatar
  • 49
1 vote
1 answer
3k views

Get string from window in curses

I am making a console game in python using curses BUT I can not find a function to get a string from the screen. Python: import curses ############ # Game Map # ############ gameMap = """ ##########...
DrevanTonder's user avatar
2 votes
3 answers
4k views

Python curses: Make enter key terminate Textbox?

I have an application where people are asked to enter their user name and password. I want them to be able to just press enter to send the name and password. To do this, I've made this: import curses,...
gowner's user avatar
  • 327
2 votes
1 answer
1k views

Sending curses application's output to tty1

Goal I'd like to make my curses Python application display its output on a Linux machine's first physical console (TTY1) by adding it to /etc/inittab, reloading init with telinit q and so on. I'd ...
Marcin Kaminski's user avatar
0 votes
1 answer
182 views

why should I use getch() here?

I'm trying to use ncurses and play with it, so I can make an interface for a program later. In the following code, why do I have to use getch()? If I don't put getch(), it doesn't work. How can I ...
iNukeLaPeste's user avatar
40 votes
5 answers
112k views

ImportError: No module named '_curses' when trying to import blessings

I am trying to run this: from blessings import Terminal t = Terminal() print (t.bold('Hi there!')) print (t.bold_red_on_bright_green('It hurts my eyes!')) with t.location(0, t.height - 1): ...
Nazarii Morhun's user avatar
0 votes
1 answer
517 views

Blackbox test with python of a ncurses python app via Paramiko

I'm in the strange position of being both the developer of a python utility for our project, and the tester of it. The app is ready and now I want to write a couple of blackbox tests that connect to ...
CaptainPhlegm's user avatar
2 votes
1 answer
5k views

Can't get KEY_UP with ncurses

i am trying to make a simple program to detect the UP key. here is my c code: #include <stdio.h> #include <ncurses.h> int main() { initscr(); noecho(); printw("hello\n"); ...
Philosoraptor's user avatar
2 votes
2 answers
1k views

Get echo/noecho state in curses in python

I can set the echo state in curses with echo() and noecho(), but how can I see what state I'm currently in? Here's what I'm trying to do: # get current echo state if screen.echo_is_on(): ...
MrPat's user avatar
  • 119
1 vote
1 answer
198 views

Refresh widget(s)

If I have a window created like this my $cui = new Curses::UI( -color_support => 1 ); my $win1 = $cui->add( 'win1', 'Window', -y => 0, ...
Tihomir Mitkov's user avatar
3 votes
1 answer
234 views

Is curses' window.insnstr broken in Python 3 for wide characters?

When printing wide characters using Python 3's ncurses bindings, spaces are compressed when using window.insnstr. Here's the code to reproduce the issue: import curses def main(window): window....
Eric Pruitt's user avatar
  • 1,845
7 votes
0 answers
2k views

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 ...
Highstaker's user avatar
  • 1,045
0 votes
2 answers
74 views

Mysql database restoring with fab and curses in django

@hosts(['localhost']) def start(): import curses screen = curses.initscr() backup_file = db_backup.sql local("mysql -u %s -p %s < " % ( db_username,db_name) + backup_file) ...
Rakesh babu's user avatar
2 votes
1 answer
2k views

Display inverse video text with python on terminal

Python has a curses module. Is there a simple way to use this module to display inverse video text? I don't want to do the full-blown curses application, just want the text to bring inverse (or in ...
vy32's user avatar
  • 29.1k
11 votes
3 answers
27k views

Make can't find curses.h

I have this program called samtools (version 1.3) that is used for manipulating the files that you get from DNA sequencing experiments. The downloaded program is contained in a folder. To set the ...
Gaussia's user avatar
  • 123
2 votes
1 answer
620 views

Scrolling data in ncurses

I'm working on a small text editor in ncurses with the purpose of learning more about the library. One of the first challenges was implementing a proper scrollable text buffer, retaining the editing ...
vinnylinux's user avatar
  • 7,100
2 votes
0 answers
1k views

Qpython curses library could not find terminal

I am trying to make a curses script on Qpython, but neither do qpy2 or 3 work. On Qpython 2, import curses says 'module not found', and on Qpython 3, it works, but at the first initscr it crashes with ...
Min4Builder's user avatar
7 votes
4 answers
2k views

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 ...
makos's user avatar
  • 157
3 votes
3 answers
949 views

C++ program to accept only the integers from the user using <curses.h> on Linux

I need to make a c++ program on Linux in which the used will only be able to input integers and no characters and special characters. Well for windows (where I have used the conio.h header file for ...
user avatar
1 vote
1 answer
789 views

Python curses menu not working [closed]

Trying to get a really basic curses menu to work. I've been following a tutorial but I've kinda split off to doing my own thing. I tried to touch on everything with comments. I just want to figure out ...
acollection_'s user avatar
1 vote
1 answer
155 views

How do I fix a converting to parameter 2 error in python curses?

I was working in Unicurses, a cross platform module of curses for python. I was trying to put the '@' character in the center of my console. My code was this: from unicurses import * def main(): ...
Garrett Delaney's user avatar
1 vote
1 answer
97 views

Curses snake game not removing cells in linux os

It's code from a curses tutorial that I've been using to get a grasp of it but even though I've checked the code multiple times, it's still not removing the old cells. The guy that wrote the code is ...
acollection_'s user avatar
1 vote
1 answer
965 views

Importing a Swift module using a C library

I've written a Curses wrapper module by following the instructions of this page. However, I do not know how to properly make it work in a module using it. I have 3 parallel directories: CCurses, ...
Shin Gototatenks's user avatar
3 votes
1 answer
1k views

Ncurses attribute A_DIM has no effect

I am programming in Linux using ncurses. When I use attron() to switch on attributes, it works for all attributes except A_DIM (which is meant to yield half bright characters). A_BOLD, A_ITALIC, ...
Maximko's user avatar
  • 637

1
9 10
11
12 13
21