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
2 answers

Python curses box() is made of 6s and 0s

So I ran into an interesting error/bug, I don't know which yet, but when running my Python curses script using the box() method I got the following result: The desired and expected out put is to be a normal box... made of lines. Here is the code for…
0
votes
1 answer

Display colored ascii art in terminal using Python curses

I want to display a colored ascii art in a terminal (for e.g. windows cmd) using python-curses. I wrote something really basic like this : import time import curses stdscr = curses.initscr() curses.noecho() curses.cbreak() stdscr.keypad(True) f =…
0
votes
2 answers

pip install windows-curser displaying error

I wanted to install curses to do a project on menu making system using Python. When I tried to import curses in jupyter, I received an error telling me there is no package such as curser... So I tried to install the curser using pip install. This is…
0
votes
0 answers

Python curses doesn't seem to work with more than 256 colour pairs

I want to use 256 colours background and 256 colours foreground for my application using curses. This requires 65536 colour pairs: which seems to be supported. curses.COLOR_PAIRS reports 65536. This is my code: def main(stdscr): …
Jachdich
  • 782
  • 8
  • 23
0
votes
1 answer

Python (or Curses) is saving key input for the next check

I'm unsure if this is the cause of Python or Curses. Whenever a user presses a key, that input is saved into a "queue". The next time the program asks for user input, it will accept whatever is in that queue. I'm wondering if there is a way to…
Lucas H
  • 3
  • 2
0
votes
1 answer

curses: how to find the height of written text area

I created a pad in curses then I filled it with a bunch of text. the height of the pad is constant, however, I would like to know how many lines there are in the written part of the pad or the height of it. rows, cols = std.getmaxyx() text_win =…
Ahmad
  • 8,811
  • 11
  • 76
  • 141
0
votes
1 answer

How Do You Display an External Program From Within Curses?

I've fallen in love with Vim and a lot of other terminal-based programs. I'm trying to write a shell in Python, using curses. I'd like to have a list of tabs, with background processes running in them (like htop and a terminal-based network…
KI4JGT
  • 471
  • 2
  • 5
  • 13
0
votes
0 answers

How to detect a character in a specific coordinate using curses?

I'm currently working on a roguelike game and trying to figure out collision detection for walls. I currently have the player being drawn at a specific y, x coordinate in the terminal but I'm having trouble figuring out how I can use this to detect…
Sugardust
  • 35
  • 4
0
votes
0 answers

Can you use the python input function in a curses window - curses.newwin()? Curses - Python

I am currently using getch, getkey and the getstr functions from the curses module and have found them not user-friendly. Why? They are all slower to detect a keypress than the python input() function. You have to hold the key down for longer than…
0
votes
1 answer

Even after installing curses(pip install windows-curses) i am getting the error (curses function returned NULL)

import curses from curses import KEY_RIGHT, KEY_LEFT, KEY_UP, KEY_DOWN from random import randint curses.initscr() win = curses.newwin(20, 60, 0, 0) win.keypad(1) curses.noecho() curses.curs_set(0) win.border(0) win.nodelay(1) this is the error…
samson
  • 1
  • 1
0
votes
1 answer

Why doesn't the window update in curses?

I took this nice example of a simple curses application with a list. I wanted to make it scrollable, so I changed the part of the list that gets shown. However, I can scroll down and back up, but the contents shown doesn't change (only the…
Martin Thoma
  • 124,992
  • 159
  • 614
  • 958
0
votes
1 answer

Python Curses - How would one space out multiple menu options horizontally?

I can easily print a list of menu options vertically in the terminal like so: menu = ["Option 1", "Option 2", "Option 3", "Option 4"] for idx, element in enumerate(menu): y = 1 + idx x = 1 stdscr.addstr(y, x, element) This outputs the…
Sugardust
  • 35
  • 4
0
votes
2 answers

Cannot stop arrows keys from echoing to the console in Python with the curses library

Below is my code. I'm trying to make a simple text editor and I tried to make sure that arrows keys wouldn't print to the console but it still does. Any help pls? import curses text = [] def main(screen): curses.curs_set(1) …
user13282002
0
votes
2 answers

curses wrapper in multithread does not restore screen after quiting

I'm trying to develop a multithreaded program with a TUI interface . Basically I have a main Loop deciding what to do and some task (like the TUI or reading data from a queue and processing it ) are running in separate thread . My TUI is using…
Chmick Chmick
  • 43
  • 1
  • 6
0
votes
1 answer

Python curses draw nvim-style gui cursor vertical bar

How to draw the cursor as a vertical bar with python curses library?
Rui Liu
  • 156
  • 1
  • 6