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

Not overwriting wrapped text in curses

I am trying to write a simple sockets-based chat application in python, and am making a client with curses. The issue I have is that you may receive messages longer than the window width, and in this case the text wraps like expected, but the next…
SigmaOne
  • 9
  • 7
0
votes
1 answer

Replace multple lines in a console in Python without Curses

So I have a script that that sends requests to a website and then displays the status codes for the response packets. Something like: METHOD | COUNT 200 | 2 results 404 | 987 results 500 | 1 results ... It takes a while to complete, so…
Sam
  • 2,172
  • 3
  • 24
  • 43
0
votes
1 answer

Python interactive console using curses lib getstr() function dosen't wait for user input

I'm trying to do an interactive console using the curses lib. similar to this : import curses if __name__ == '__main__': stdscr = curses.initscr() stdscr.nodelay(False) curses.echo() curses.nonl() while True: …
Hans Daigle
  • 364
  • 2
  • 14
0
votes
2 answers

Python ncurses addstr expected bytes or str, got int

I am attempting to create an ASCII level editor in Python using curses but I'm having issues. I get Traceback (most recent call last): File "lvleditor_curses.py", line 36, in editor.newLine() File "lvleditor_curses.py", line 31, in newLine…
Jordan Baron
  • 3,752
  • 4
  • 15
  • 26
0
votes
1 answer

_curses.error: setupterm: could not find terminal, Raspberry Pi

Every time I run this script on my Raspberry Pi: import curses import RPi.GPIO as GPIO GPIO.setwarnings(False) GPIO.setmode(GPIO.BOARD) motor1a = 7 motor1b = 11 motor1e = 22 motor2a = 13 motor2b = 16 motor2e =…
0
votes
0 answers

Facing strange difficulties in importing python modules (curses)

I am facing some issues as I can't create a 'Snake' game using 3.6.3 python. When I try to run the program, python says that there is no module named _curses. It will state error upon import curses. So I tried all methods to install python curses.…
0
votes
0 answers

Python curses with scrolling terminal

I want to build an app on my raspberry pi using Python that uses a curses-style display over part of the screen and keeping the terminal visible (whilst printing scrolling status messages in it) over the rest of the screen. I also want to be able to…
kjgregory
  • 656
  • 2
  • 12
  • 23
0
votes
1 answer

npyscreen - switchForm(formid) error

I am using npyscreen and i would like to understand how the switchForm method works. I did a small example that I took from the documentation and from this question (that didn't answer my question). My Code: import npyscreen import sys class…
jerem0808
  • 95
  • 1
  • 12
0
votes
1 answer

Python Curses how to print in the middle of the Terminal

I'm trying to make a tiny arcade game in curses and this has been bugging me out for the past 40 minutes. How do you print something in the middle of the screen and also what is wrong with my syntax on the first screen.addstr (Game Over) I am…
Decim
  • 11
  • 3
0
votes
1 answer

print in same curses multiple times - python

I'm showing some live stats from a process with curses. I'm newby with this library, so I followed this example to implement what i need. I write this small version which summarizes my problem: import time import curses def draw_menu(stdscr): …
Rodrigo Laguna
  • 1,796
  • 1
  • 26
  • 46
0
votes
1 answer

How can I access a position on screen in Curses?

I'm trying to program Conway's game of life on Python, without using classes or the self. thing. I'm really new to curses, and I want to make a condition like: if screen[y][x] == '*': neighbour_count+=1 Where y and x are the coordinates on the…
Weirdo
  • 42
  • 9
0
votes
1 answer

Getch gets input before it is called

I'm writing a curses application in python. def main(stdscr): stuff(stdscr) def printStuff(stdscr, string): stdscr.clear() stdscr.addstr(0, 0, string) stdscr.refresh() def stuff(stdscr): printStuff(stdscr, 'foo') …
Emlingur
  • 163
  • 8
0
votes
0 answers

Python while key pressed function

I recently built an robot that's working with the Raspberry Pi 3 B. I have made a script for it to move forward, backward, left/right with some functions. import curses #some more code# while True: char = screen.getch() if char == ord('q'): …
0
votes
2 answers

Linux terminal print weird characters when using curses library

When trying to run stuff like https://github.com/asciimoo/drawille/blob/master/examples/rotating_cube.py Using my normal user I always get weird characters like M-bM- ~@M-bM- ~@M-bM- ~@M-bM- ~@M-bM- ~@M-bM- ~@M-bM- ~@M-bM- ~@M-bM- ~@M-bM-…
snebel29
  • 179
  • 2
  • 6
0
votes
1 answer

Curses keypad(True) does not get special keys

I am trying to write code for both Python 2 and 3. Here is my complete code that I am using to learn curses: # -*- coding: utf-8 -*- from __future__ import print_function import curses import sys import traceback class Cursor(object): def…
user4805123