ncurses

Menu dividers in ncurses

故事扮演 提交于 2020-01-06 02:39:10
问题 I'd like to build a menu in ncurses that has section dividers. My example list looks like this: Aardvark Apple Bee Cat Kitten Kalashnikov Waffle What I want is non-selectable dividers. Something like this: (A) ---- Aardvark Apple (B) ---- Bee (C) ---- Cat (K) ---- Kitten Kalashnikov (W) ---- Waffle Is there a built-in way to do this? More specifically, I'm using this ruby gem: https://github.com/eclubb/ncurses-ruby I'd prefer an answer that was generic, but if it can be solved with Ruby

ncurses: init_color() has no effect

徘徊边缘 提交于 2020-01-05 11:47:59
问题 Trying to define color pairs, I was getting strange results. All 256 colors are already defined, and attempt to change any color with init_color() has no affect. I'm using Putty with 256-colors enabled and TERM=xterm-256color (also putty-256color), ncurses 6.0 compiled with --enable-widec and --enable-ext-colors. This shows all colors are defined and the init_color() doesn't change anything even though it succeeds: init_scr(); start_color(); if (has_colors() && COLORS == 256 && can_change

Python ncurses: Doesn't show screen until first key-press, even though refresh is first

徘徊边缘 提交于 2020-01-04 06:54:19
问题 The code below lets you walk around a small grid on the screen using the arrow keys putting "." where you've explored or been next to. Even though I have my refresh before the first getch (to get a key-stroke) the screen doesn't first display anything until you've moved off your starting position. Shouldn't the addstr followed by refresh immediately show and then the getch waits after that? I even tried adding a stdscr.refresh(), but that didn't help either. How do I get the screen to refresh

tput: unknown terminal “xterm-256color”

蓝咒 提交于 2020-01-04 05:35:53
问题 I'm running OS X 10.10.5. I'm getting an error trying to open a terminal: tput: unknown terminal "xterm-256color" This is obviously a missing termcap entry. $ port list ncurses ncurses @6.0 devel/ncurses Any ideas how to install 'ncurses-term' on OS X? $ sudo port install ncurses-term Password: Error: Port ncurses-term not found 回答1: The problem was with an Anaconda package: https://groups.google.com/a/continuum.io/forum/#!topic/anaconda/XKMFYqM12Vg It appears there is some problem with an

tput: unknown terminal “xterm-256color”

落爺英雄遲暮 提交于 2020-01-04 05:35:08
问题 I'm running OS X 10.10.5. I'm getting an error trying to open a terminal: tput: unknown terminal "xterm-256color" This is obviously a missing termcap entry. $ port list ncurses ncurses @6.0 devel/ncurses Any ideas how to install 'ncurses-term' on OS X? $ sudo port install ncurses-term Password: Error: Port ncurses-term not found 回答1: The problem was with an Anaconda package: https://groups.google.com/a/continuum.io/forum/#!topic/anaconda/XKMFYqM12Vg It appears there is some problem with an

detect automatic key-repeats in curses

随声附和 提交于 2020-01-03 21:00:57
问题 I'm writing a little text mode application using curses on Linux. For keyboard input I use the curses functions. Key auto-repeats work, e.g. if I hold a key down I get multiple key events until I release the key again. Is it also possible to distinguish between real key events and those generated by the key repeat logic? Background: The application is a little data-entry front-end where the user can modify integer numbers of certain parameters. In the long run the application will work

Interrupt (n)curses getch on incoming signal

╄→尐↘猪︶ㄣ 提交于 2020-01-02 00:54:11
问题 One of my programs uses ncurses for drawing a small tui. One of my goals is to make it rather portable to other curses implementations. This means that I want to catch a SIGWINCH issued by the terminal emulator on a resize operation myself and update my tui to adhere the changed geometry (and not depend on the resizing facilities of ncurses). Since POSIX (as far as I know) only allows access to sig_atomic_t variables within the signal handler, I set one to a different state. In the main loop,

(n)curses pad in python not working

柔情痞子 提交于 2020-01-01 10:05:25
问题 I cannot seem to get ncurses pads to work in python (2.6, 2.7, and 3.2). Using code directly off of http://docs.python.org/howto/curses.html I even cannot get it to work. Non-pad code works perfectly. import curses def func(scr): pad = curses.newpad(100, 100) pad.addstr(0,0, "Testing") # Displays a section of the pad in the middle of the screen pad.refresh( 0,0, 5,5, 10,10) scr.refresh() scr.getch() if __name__ == '__main__': curses.wrapper(func) What can the issue be? Removing the pad (and

Using more lines than the window has with ncurses

亡梦爱人 提交于 2020-01-01 00:23:08
问题 I have recently been introduced to ncurses for asynchronous keyboard key listening, and getting on well with it. One issue i'm facing is that you can only have text on the visible screen, no scrollbars. I was wondering if its possible to keep using ncurses as it is so lovely, but have the program still keep the scrollbars rather than getting to the last line and staying there. 回答1: scroll(). You have to set scrollok(win, TRUE) first. Actually if you just want to spew data like a normal

Using more lines than the window has with ncurses

有些话、适合烂在心里 提交于 2020-01-01 00:23:04
问题 I have recently been introduced to ncurses for asynchronous keyboard key listening, and getting on well with it. One issue i'm facing is that you can only have text on the visible screen, no scrollbars. I was wondering if its possible to keep using ncurses as it is so lovely, but have the program still keep the scrollbars rather than getting to the last line and staying there. 回答1: scroll(). You have to set scrollok(win, TRUE) first. Actually if you just want to spew data like a normal