curses

How can I screen-scrape output from telnet in Perl?

风格不统一 提交于 2019-12-01 15:13:00
问题 I can setup a telnet connection in Perl no problems, and have just discovered Curses, and am wondering if I can use the two together to scrape the output from the telnet session. I can view on a row, column basis the contents of STDOUT using the simple script below: use Curses; my $win = new Curses; $win->addstr(10, 10, 'foo'); $win->refresh; my $thischar=$win->inch(10,10); print "Char $thischar\n"; And using the below I can open a telnet connection and send \ receive commands with no problem

How to Build Curses Program That Supports More Than 223 Columns of Mouse Input

只谈情不闲聊 提交于 2019-12-01 14:43:30
I'm trying to get a curses program working with my terminal spanning my monitor. However, the x coordinate can't move past the 223rd column, instead it loops around. In the source, this seems to be due to them being defined as 8-bits, and having the position values start only after the first 32 values (i.e. x = raw_x - ' '). Here's an example program from https://gist.github.com/sylt/93d3f7b77e7f3a881603 that demonstrates the issue when compiled with libncurses5. In it, if your cursor moves more than 233 columns to the right of the window, the x value will loop back over to 0 - ' ', i.e. -32

How to Build Curses Program That Supports More Than 223 Columns of Mouse Input

*爱你&永不变心* 提交于 2019-12-01 12:22:55
问题 I'm trying to get a curses program working with my terminal spanning my monitor. However, the x coordinate can't move past the 223rd column, instead it loops around. In the source, this seems to be due to them being defined as 8-bits, and having the position values start only after the first 32 values (i.e. x = raw_x - ' '). Here's an example program from https://gist.github.com/sylt/93d3f7b77e7f3a881603 that demonstrates the issue when compiled with libncurses5. In it, if your cursor moves

curses in python getstr() while refreshing

爱⌒轻易说出口 提交于 2019-12-01 07:03:04
I am writing a front end for a server application using the curses module. THe main windows returned by curses is divided into 2 sub-windows. The top half of the screen prints output from the server while the bottom line takes input with window.getstr(). Sometimes when I am entering text and the top half is updating the whole screen goes crazy with random characters replacing the existing characters. Is there a specific cause for this or is it a curses bug? I'm guessing you are using a thread to update the upper display while window.getstr() runs in the main thread? If so, the problem is that

curses in python getstr() while refreshing

社会主义新天地 提交于 2019-12-01 04:16:18
问题 I am writing a front end for a server application using the curses module. THe main windows returned by curses is divided into 2 sub-windows. The top half of the screen prints output from the server while the bottom line takes input with window.getstr(). Sometimes when I am entering text and the top half is updating the whole screen goes crazy with random characters replacing the existing characters. Is there a specific cause for this or is it a curses bug? 回答1: I'm guessing you are using a

ncurses and stdin blocking

為{幸葍}努か 提交于 2019-11-30 16:04:28
I have stdin in a select() set and I want to take a string from stdin whenever the user types it and hits Enter . But select is triggering stdin as ready to read before Enter is hit, and, in rare cases, before anything is typed at all. This hangs my program on getstr() until I hit Enter . I tried setting nocbreak() and it's perfect really except that nothing gets echoed to the screen so I can't see what I'm typing. And setting echo() doesn't change that. I also tried using timeout(0) , but the results of that was even crazier and didn't work. What you need to do is tho check if a character is

Xcode and Curses.h with Error opening terminal

末鹿安然 提交于 2019-11-30 14:21:50
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. Running… I can go to build folder and just open the program in terminal but is there any way for xcode

How to manage logging in curses

♀尐吖头ヾ 提交于 2019-11-30 11:51:51
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) logger.setLevel(logging.DEBUG) #formatter = logging.Formatter( # "%(asctime)s %(threadName)-11s %

Curses getting arrow keys

旧巷老猫 提交于 2019-11-30 11:13:45
In trying to get input from the arrow keys via curses (ncurses) it won't catch as KEY_UP etc. I used the keypad function with a true argument but getch still returns an escaped sequence. How do I sift through the values returned by getch() and grab the arrow keys specifically? Paul Franz I found the same problem on Mac OS X. But it was resolved by adding the following: keypad(stdscr, TRUE); I was storing getch() calls as char's when they were supposed to be int's. Works perfectly after the switch. Standard (VT100-like) terminals send a sequence of characters when the arrow keys are pressed.

How do I detect arrow keys pressed using curses in C?

ε祈祈猫儿з 提交于 2019-11-30 07:25:08
问题 In trying to get input from the arrow keys via curses (ncurses) it won't catch as KEY_UP etc. I used the keypad function with a true argument but getch still returned an escaped sequence. How do I shift through the values returned by getch() and grab the arrow keys specifically? 回答1: I found the same problem on Mac OS X. But it was resolved by adding the following: keypad(stdscr, TRUE); 回答2: I was storing getch() calls as char's when they were supposed to be int's. Works perfectly after the