curses

How do I use (n)curses in Ruby?

半腔热情 提交于 2019-11-28 17:11:39
I'd like to create a progress bar to indicate the status of an a batch job in Ruby . I've read some tutorials / libraries on using (n)curses , none of which were particularly helpful in explaining how to create an "animated" progress bar in the terminal or using curses with Ruby . I'm already aware of using a separate thread to monitor the progress of a given job, I'm just not sure how to proceed with drawing a progress bar. Update ProgressBar class was incredibly straight-forward, perfectly solved my problem. You might be able to get some implementation ideas from the Ruby/ProgressBar library

Ruby Keyboard event handling

不想你离开。 提交于 2019-11-28 11:26:43
问题 Hello im using curses to develop a small console application. I have a main loop section wich waits for user input, it uses the getstr function, of course this waits for the user to press enter. I would like to capture the up and down and tab keypresses. I suppose this can't be done with getstr. Anyone have any idea how to do this? EDIT: i've tried using STDIN.getc wich blocks the application from running, and getch doesnt catch the arrow keys EDIT #2 : im trying this code on windows. It

How do I use getch from curses without clearing the screen?

这一生的挚爱 提交于 2019-11-28 10:07:36
I'm learning to program in C and want to be able to type characters into the terminal while my code is running without pressing return . My program works, however when I call initscr() , the screen is cleared - even after calling filter() . The documentation for filter suggests it should disable clearing - however this is not the case for me. #include <stdio.h> #include <curses.h> #include <term.h> int main(void) { int ch; filter(); initscr(); cbreak(); noecho(); keypad(stdscr, TRUE); while((ch = getch()) != EOF); endwin(); return 0; } Why does the above code still clearr the screen, and what

Python/curses user input while updating screen

旧城冷巷雨未停 提交于 2019-11-28 04:54:35
问题 I'm currently coding an app U.I with python/curses and I was wondering if it is possible to ask the user to press keys (cbreak mode) to hide or show some panels or windows while the U.I is continuously updating. I read the official python docs about curses and made some tries but even with the use of the cbreak mode and the non-blocking input mode (nodelay) activated I am unable to make it work properly (I succeed in getting the user input but at the expense of blocking the U.I that is not

Pycharm : how-to launch for a standard terminal (to solve an issue with curses)

穿精又带淫゛_ 提交于 2019-11-27 16:25:51
问题 I'm facing a weird problem. Using Pycharm (please do not troll about this fact), I'm trying to launch a short app that uses ncurses to render some things on my term. While I can launch the project in a simple term without any problem, launching it from Pycharm raise the following error : File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/curses/__init__.py", line 33, in initscr fd=_sys.__stdout__.fileno()) error: setupterm: could not find terminal Process finished

Why is curses on linux giving me following error?

只谈情不闲聊 提交于 2019-11-27 16:23:13
问题 Trying to get getch() working to capture key press. #include <curses.h> ... ... WINDOW *w; char f; w = initscr(); timeout(3000); f = getch(); endwin(); is giving me following error:- undefined reference to `wgetch' undefined reference to `stdscr' 回答1: That's a linking error. Are you linking to the curses library correctly? There are two steps involved in using a library in C. You #include the relevant header files from your source files. This is so your code knows what signatures of the

Setupterm could not find terminal, in Python program using curses

若如初见. 提交于 2019-11-27 04:59:21
I am trying to get a simple curses script to run using Python (with PyCharm 2.0). This is my script: import curses stdscr = curses.initscr() curses.noecho() curses.cbreak() stdscr.keypad(1) while 1: c = stdscr.getch() if c == ord('p'): print("I pressed p") elif c == ord('q'): break curses.nocbreak(); stdscr.keypad(0); curses.echo() curses.endwin() When I run this from my IDE (PyCharm 2) I get the following error: _curses.error: setupterm: could not find terminal Process finished with exit code 1 If I run the script from bash it will simply be stuck in the while loop not reacting to either

Outputting unicode characters in windows terminal

自古美人都是妖i 提交于 2019-11-27 04:47:37
问题 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 otuputting some unicode characters such as \u263B (☻), but others such as \u2638 (☸) will just end up as question marks(?). Here's the relevant code I use for output. // Container of room information struct RoomInfo { wchar_t * layout; int width; int height

How do I use getch from curses without clearing the screen?

狂风中的少年 提交于 2019-11-27 03:24:40
问题 I'm learning to program in C and want to be able to type characters into the terminal while my code is running without pressing return . My program works, however when I call initscr() , the screen is cleared - even after calling filter() . The documentation for filter suggests it should disable clearing - however this is not the case for me. #include <stdio.h> #include <curses.h> #include <term.h> int main(void) { int ch; filter(); initscr(); cbreak(); noecho(); keypad(stdscr, TRUE); while(

What is needed for curses in Python 3.4 on Windows7?

谁说胖子不能爱 提交于 2019-11-27 01:24:46
I have a running Python 2.7/3.4 installation on my Windows 7 (x64) machine. I would like to test curses on Windows. Curses is installed but not working: >>> import curses Traceback (most recent call last): File "<stdin>", line 1, in <module> File "C:\Tools\Python3.4.2\lib\curses\__init__.py", line 13, in <module> from _curses import * ImportError: No module named '_curses' The documentation says: The Windows version of Python doesn’t include the curses module. A ported version called UniCurses is available. So, the Windows installer of Python 3.4 installed curses with unresolved dependencies.