curses

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

耗尽温柔 提交于 2019-12-18 04:21:04
问题 This question already has answers here : How to avoid pressing enter with getchar() (11 answers) Closed 3 years ago . 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(); /

How do I use (n)curses in Ruby?

纵然是瞬间 提交于 2019-12-17 23:20:47
问题 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

How to disable “curses.h” header (a part of "stdio.h in Xcode 6.3 OSX Yosemite) to avoid conflicting function declarations

荒凉一梦 提交于 2019-12-17 21:16:48
问题 I'm trying to build a project in Xcode but I get errors Implicit declaration of function 'clear' is invalid in C99 and Conflicting types for 'clear' . Here's the code: //main.c #include <stdio.h> #include "tree.h" int main(){ clear(); // Implicit declaration of function 'clear' is invalid in C99 return 0; } //tree.c #include <stdio.h> #include "tree.h" void clear(){ ///Conflicting types for 'clear' printf("Command clear.\n"); } //tree.h #include <stdio.h> void clear(); ///Conflicting types

Windows安装Python3 curses模块

混江龙づ霸主 提交于 2019-12-17 11:56:57
目录 0.前提 1.pip install wheel 2.下载.whl文件 3.pip install 它 参考 0.前提 确定你已经配置好了Python相关环境,可以正常在命令行使用pip安装。 1.pip install wheel 在命令行键入 pip install wheel 2.下载.whl文件 下载地址 选择自己的版本下载,比如我是Python37,64位,所以选择这一个。 3.pip install 它 在命令行切换路径到刚刚那个文件下载到的地方。 pip install 文件名 这样就可以了,不必在意。 参考 安装参考1 安装参考2 curses的使用 来源: https://www.cnblogs.com/hardcoreYutian/p/11270871.html

How to create scrollable console application that support ANSI escape code sequences

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-14 03:12:45
问题 I am making some assumptions here on technology based on what I know, but other technology recommendations are welcome. My goal: Write an ANSI Art viewer that as closely as possible resembles viewing on a DOS machine as possible, preferably without the overhead of running dosbox. This will run on a Raspberry Pi. I have gotten my console to properly cat an ANSI with proper characters, colors, etc. The catch with the "viewer" is that I would like to be able to use the arrow keys to scroll up

Method to tell PDCurses to make the window the same size as the physical screen programatically?

馋奶兔 提交于 2019-12-14 02:32:31
问题 Currently I have an c++ console application running on Win7/AIX/Linux. In the application I use getmaxyx to get the dimensions of the window. getmaxyx(_window, _rows, _cols); On the windows platform i need to play around with the (properties)(layout) options of the running app, to get the screen maximized. That is a bit of a pain. Thumbing through the documention yields nothing of value. lines: Specifies the number of lines the "screen" will have. Directly equates to LINES. There is no

How to refresh curses window correctly?

≡放荡痞女 提交于 2019-12-14 00:18:47
问题 while 1: ... window.addstr(0, 0, 'abcd') window.refresh() ... window size is full terminal size, big enough to hold abcd . If 'abcd' is modified to shorter string like 'xyz' , then on terminal I will see 'xyzd' . What exactly I am doing wrong? 回答1: addstr() only prints the string you specify, it does not clear the following characters. You will have to do that yourself: To clear characters until the end of the line, use clrtoeol(), To clear characters until the end of the window, use clrtobot

Unable to install curses (python/windows 10)

老子叫甜甜 提交于 2019-12-13 11:00:10
问题 I have tried to use python -m pip install windows-curses and the error that shows up is: ERROR: Could not find a version that satisfies the requirement windows-curses (from versions: none) I have also tried the method provided by this answer and the same error shows up in my terminal window. How can I install Curses for Python/Windows 10 on my machine? 回答1: What's your Python version? This library works on 2.7 and 3.5+. I have installed here without problems. I have tested in 3.6 and 3.7 and

Threading with Python Curses giving me weird characters?

旧城冷巷雨未停 提交于 2019-12-13 07:25:50
问题 Hey there Stack Overflow. I'm trying to build a testing script that should mix outputting changing characters (using curses) on multiple lines (creating them over time), creating new lines based on the thread number. I have the below code: # -*- coding: utf-8 -*- import curses, time, threading def threadedFunction(linePos): stdscr = curses.initscr() curses.noecho() curses.cbreak() try: stdscr.clear() for i in range(50): stdscr.addstr(linePos, 0, "testing %s..." % i) stdscr.refresh() time

Bug with refresh in python curses

两盒软妹~` 提交于 2019-12-13 04:55:19
问题 I'm writing a program in curses and sometimes happens that if I leave the program opened and I use other terminal tabs for a while, when I go using the program again it seems like it has refreshed something and something has disappeared... I cannot show pics or screenshots because I haven't understood yet well when and how it happens... Is there a way to prevent or fix this? 回答1: screen.getch reads from stdscr , and if it refreshes (due to any change on the screen), will overwrite boxes . You