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
0
votes
1 answer

How to properly work with Curses::KEY_BACKSPACE in Ruby

Suppose that I have the following code: require 'curses' Curses.init_screen loop { ch = Curses.getch case ch when Curses::KEY_BACKSPACE Curses.addstr('Backspace \n') else Curses.addstr("Key: #{ch} \n") …
FrozenHeart
  • 19,844
  • 33
  • 126
  • 242
0
votes
3 answers

Why the exit function doesn't actually terminate the program

Why the second thread doesn't actually terminate the program and application still waits for the input from the first thread? Curses.init_screen first = Thread.new do loop { Curses.getch } end second = Thread.new do Curses.close_screen …
FrozenHeart
  • 19,844
  • 33
  • 126
  • 242
0
votes
1 answer

Python Curses showing segmentation fault

Im trying to create a pad which a bunch of text in it that ill then look to scroll through. However I just get a segmentation fault ? import curses,sys from curses import wrapper import random,string def main(stdscr): pad = curses.newpad(100,…
felix001
  • 15,341
  • 32
  • 94
  • 121
0
votes
1 answer

How would I handle the event of a thread finishing in python?

Say I am parsing data from a few different exchanges, I want each extra to run simultaneously so I start each one up in its own process, but inside each process I want to add output string to a list then return that list to the main and output it to…
Jay Bell
  • 77
  • 6
0
votes
1 answer

Global name not working in python

I am coding a program where I am using curses to create a UI and I have gotten the width and height of the terminal via a different command and I want to make those two variables global so that I can refer to them throughout the program without…
Jay Bell
  • 77
  • 6
0
votes
1 answer

PDCurses KEY_ENTER does not work

Lets start with what my code looks like then I will explain my problem: int main { char ch; //Stores key presses initscr(); raw(); nonl(); keypad(stdscr, TRUE); noecho(); //Some code ch = getch(); switch (ch) { case KEY_UP:{ …
TheKingOfAtlantis
  • 1,792
  • 2
  • 12
  • 18
0
votes
0 answers

Is there a mistake in the curses module in the Python library?

I am using Eclipse with PyDev and Python 3.4.1. I would like to try the curses lib included with Python. I have read the documentation for Python 3.4.1 and the tutorial there gives the code: import curses stdscr = curses.initscr() However, I am…
Klik
  • 1,757
  • 1
  • 21
  • 38
0
votes
1 answer

Curses.getstr cleans windows on the first call

The first Curses.getstr call clears another window. On later calls it doesn't happen. require "curses" Curses.init_screen window = Curses::Window.new(10, 10, 5, 0) window.scrollok true Thread.new do loop do window.addstr…
Nakilon
  • 34,866
  • 14
  • 107
  • 142
0
votes
2 answers

Printing dictionary where the keys are static, and values dynamic in terminal

I have a REST URL It returns a large JSON object as a dictionary. {"id": 1, "name" : bobert, "cash" : 100} I'm doing the basic print key, value, however here's the challenge: I need it to look like this. id : 1 name : bobert cash : 100 ^^^ I…
Balrizangor
  • 244
  • 3
  • 15
0
votes
1 answer

Python, Curses, Dictionary not updating outside of loop

I am having trouble where a dictionary is not updating its contents where some of the contents are defined by a variable in a loop after the dictionary is defined. It reads the initial value of the variable the first run just fine, but after the…
jslay
  • 479
  • 4
  • 9
0
votes
1 answer

libncurses: non-blocking STDIN + select on socket

I'm using select to do non-blocking reads from a socket and STDIN. In pseudo-code: loop readable = select(socket, STDIN) foreach input in readable if input == STDIN handle_keyboard_input(read(STDIN)) else …
rlkw1024
  • 6,455
  • 1
  • 36
  • 65
0
votes
1 answer

How do I show a statement repeatedly on the command line using curses?

I'm struggling a little with curses module in Python. I'm trying to get it to show this constantly updating statement (in a loop): print(i/(time.time()-start_time)) on one line rather than multiple lines. What's the easiest way?
cjm2671
  • 18,348
  • 31
  • 102
  • 161
0
votes
2 answers

Event-style key input with python ncurses

I'm trying to create a python script that will do a load of computation while continually updating a curses interface (for the purposes of this question, just imagine it's a progress bar). The code is structured like this: while notDone: …
Jack M
  • 4,769
  • 6
  • 43
  • 67
0
votes
1 answer

Importing rlcompleter causes terminal resize to fail?

Consider the following code. import curses import rlcompleter def main(stdscr): while 1: c = stdscr.get_wch() curses.wrapper(main) When I run this and resize my terminal, the program fails at the get_wch, saying Traceback (most recent…
chtenb
  • 14,924
  • 14
  • 78
  • 116
0
votes
1 answer

How can I block certain keys in C++ with NCurses

I'm new to C/C++ and I'm making a simple text user interface with NCurses. Whenever I scroll up/down with the mouse wheel, or press arrow keys, the console echos characters like: "[[A^[[C^[[B^[[D" to show me that I've pressed the keys. I would…
Connor
  • 670
  • 3
  • 9
  • 29