curses

Python ncurses, CDK, urwid difference

家住魔仙堡 提交于 2019-11-29 23:01:24
What's the difference between these 3? As far as I understand it they both provide binding to curses which is the C library for terminal text-based UI. I currently have no knowledge of any of the 3 and I've never used curses. Which one would you recommend? I've heard of ncurses many times but only once or twice about CDK (through research) and never heard of urwid (I think). What I get after looking at some references is: ncurses : It's a free software version of curses, so you have to deal with all kind low-level details. pyCDK : It's a higher level library that provides some widgets. I haven

Xcode and Curses.h with Error opening terminal

邮差的信 提交于 2019-11-29 19:51:58
问题 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 Target"program"Info -> General -> Linked Libraries, libCurses.dylib has been added. It compiles fine but the terminal window will not open. In the Debug Console the output is, Program loaded. run [Switching to process 3424] Error opening terminal: unknown.

How to manage logging in curses

*爱你&永不变心* 提交于 2019-11-29 17:44:42
问题 I created a simple UI for my application using curses and I also include logs (logging) in my modules using herarchy structure (logmain, logmain.child1) and so on. In case an log event occurs the log is displayed in my UI,distroying its apparence. I also created a pad (myLogPad) in order toput there the incoming logs, but without success. How I can intercept the log event and print it in a specific area (last line) of my screen? def setupLogger(name,file_name): logger = logging.getLogger(name

Ruby Keyboard event handling

倾然丶 夕夏残阳落幕 提交于 2019-11-29 16:46: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 seems that Curses.getch works for linux, but on windows i get no key sent for the up arrow. You need to set

Attribute BOLD doesn't seem to work in my curses

倾然丶 夕夏残阳落幕 提交于 2019-11-29 15:11:16
I use something like this: screen.addstr(text, color_pair(1) | A_BOLD), but it doesn't seem to work.. However, A_REVERSE and all others attribute does work! In fact, I'm trying to print something in white, but the COLOR_WHITE prints it gray.. and after a while of searching, it seems that printing it gray + BOLD makes it! Any helps would be greatly appreciated. Here's an example code (Python 2.6, Linux): #!/usr/bin/env python from itertools import cycle import curses, contextlib, time @contextlib.contextmanager def curses_screen(): """Contextmanager's version of curses.wrapper().""" try: stdscr

Outputting unicode characters in windows terminal

£可爱£侵袭症+ 提交于 2019-11-29 10:49:46
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; }; // The following function builds RoomInfo RoomInfo Room::examine(IActor * examinor) { RoomInfo ri;

Learning Ruby Curses

那年仲夏 提交于 2019-11-29 05:38:53
问题 Does anyone know of any good tutorials for learning Ruby with Curses? I just can't seem to find one and the doc is very vague. I have never used curses before so I really don't know much about it. 回答1: You can see the basics in action at the curses tic tac toe 回答2: Here's some suggestions from a previous question: How do I use ncurses in Ruby? 来源: https://stackoverflow.com/questions/1309218/learning-ruby-curses

how to get a character from stdin without waiting for user to put it? [duplicate]

徘徊边缘 提交于 2019-11-29 05:02:34
This question already has an answer here: How to avoid pressing enter with getchar() 10 answers I'm writing a C program that prints something on terminal using ncurses. It should stop printing when user press 's' and continue again when press 's'. How can I read a key from input without waiting user to press the key? I tried getch() and getchar() but they wait until a key is pressed... Edit This is my code: int main(void) { initscr(); /* Start curses mode */ refresh(); /* Print it on to the real screen */ int i = 0, j = 0; int state = 0; while (1) { cbreak(); int c = getch(); /* Wait for user

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

允我心安 提交于 2019-11-29 02:06:36
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 with exit code 0 As far as I can see, all is about terminal environment variables. Pycharm launch the

Python ncurses, CDK, urwid difference

喜夏-厌秋 提交于 2019-11-28 20:01:30
问题 What's the difference between these 3? As far as I understand it they both provide binding to curses which is the C library for terminal text-based UI. I currently have no knowledge of any of the 3 and I've never used curses. Which one would you recommend? I've heard of ncurses many times but only once or twice about CDK (through research) and never heard of urwid (I think). 回答1: What I get after looking at some references is: ncurses: It's a free software version of curses, so you have to