Questions tagged [python-curses]

The Python curses module provides an interface to the curses library, the de-facto standard for portable advanced terminal handling.

The Python curses module provides an interface to the curses library, the de-facto standard for portable advanced terminal handling.

https://docs.python.org/2/library/curses.html

271 questions
0
votes
0 answers

Capturing key presses from the terminal

I am trying to write a program that captures at any time which key is being pressed. The ultimate goal is to control a robot from the keyboard, e.g. using wasd keys to control movement. It's rather easy using pygame, but as I want to be able to…
NiH
  • 434
  • 6
  • 16
0
votes
0 answers

Center python curses.panel sub-menu

I have problems in centering the following curses.panel sub-menu: import curses from curses import panel class Menu(object): …
0
votes
1 answer

Curses giving error when running curses.initscr() - python

Background: I recently installed curses with pip install curses I found a couple tutorials online (https://www.devdungeon.com/content/curses-programming-python, https://docs.python.org/3/howto/curses.html,…
0
votes
1 answer

What is wrong with my code? It is not letting me increase and decrease the heart rate with my arrow keys

I am trying to make a program where you can use the up and down arrow keys to increase a decrease a persons displayed heart rate. import curses running = True heart_rate = 1 key = curses.KEY_RIGHT print(heart_rate) if key == curses.KEY_UP: …
0
votes
1 answer

How to merge two different borders in curses

Using curses for python, how can I seamlessly merge two borders? For example: import curses screen = curses.initscr() curses.curs_set(0) screen.border() screen.refresh() awindow = curses.newwin(3, curses.COLS, 0,…
noibe
  • 327
  • 5
  • 18
0
votes
1 answer

Why when I comment the line where I enabled stdscr.nodelay() nothing changes?

I'm coding a snake game... yes, I know, how original. My problem is the following: I enabled nodelay() by writing stdscr.nodelay(1) and then I did set the timeout() to 100 miliseconds by writing stdscr.timeout(100). Happens what I expected.…
Martín Nieva
  • 476
  • 1
  • 5
  • 13
0
votes
1 answer

How do I install curses library in my editor?

I cannot install the curses library in my Editor. Is there some other way to make sure I have the library installed and can import it? I'm trying to build a tictactoe game using venv, in Pycharm Community Edition. I imported curses in the directory…
mach3
  • 117
  • 1
  • 1
  • 6
0
votes
1 answer

How to color auto-echoed charactes in curses?

curses.echo() prints every hit key. I know how to change color when using addstr, but I don't know how to print some auto-echoed letters in red.
user3565923
  • 153
  • 2
  • 12
0
votes
0 answers

How to add color using python3 curses.window.addch?

I tried to print colorful output using python3 curses: #!/usr/bin/env python3 import curses def main(stdscr): curses.start_color() curses.use_default_colors() # 0 is always black for i in range(0, curses.COLORS): …
JiaHao Xu
  • 2,452
  • 16
  • 31
0
votes
0 answers

Multiple processes not printing correctly, how can they print to the same stdscr()?

I'm working at an unzipper application, and i want to use multiple processes to unzip a number of files from a directory, and i want to have a screen to know about every process and what is it unzipping I'm really new to python programming and I'm…
0
votes
1 answer

Type error: Missing required positional arguments with multiple .py files

I want to create a class and then an object which will display a red square in my display i also created. At this moment, I can only display the blue square, which is not an object of the class "Baustein". Here are my 2 files im using right…
0
votes
1 answer

Center input in python cmd?

I'm working on a classic text-adventure port in python. I'm wondering is it possible to center a users input? I found out that using str.center() method, I can center the printed text, however, I can't center the python input() function. Using…
Tom
  • 571
  • 2
  • 11
  • 29
0
votes
2 answers

Trying to make the Snake game on Python. Where do I download the cursor extension

So I'm new to python. I was messing around on youtube and I found this video that shows a dude coding a snake game in under 5 min. This interested me so I tried copying all his code. It is correct for as far as I can see except when I run it, it…
Alex
  • 7
  • 2
0
votes
1 answer

Python Curses Backspace detection works in main window but not in subwindows

I've written this function that takes user input of a specified screen for a specified length: def get_str(scr, max_len): curses.echo() curses.curs_set(2) usr_in = '' cur_len = 1; tmp = scr.getkey() while(tmp != '\n'…
0
votes
1 answer

Displaying different strings based on input

I've been trying to get this script to work as intended but have been having some issues in doing so. I'm trying to change the string displayed on screen depending on the variable pageCount, but have ran into 2 issues so far. I would like the first…