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
1 answer

Write an UTF8 character to the last position of the screen with Python curses

How to write a UTF8 character to the last position (bottom right) of the screen with Python's curses module? The task might look straight forward at first, but it isn't. First of all, Python 2.x is incapable of outputting UTF-8 using curses, so…
Helmut Grohne
  • 6,578
  • 2
  • 31
  • 67
0
votes
2 answers

python curses addstr y-offset: strange behavior with unicode

I am having trouble with python3 curses and unicode: #!/usr/bin/env python3 import curses import locale locale.setlocale(locale.LC_ALL, 'en_US.UTF-8') def doStuff(stdscr): offset = 3 stdscr.addstr(0, 0, "わたし") stdscr.addstr(0, offset,…
0
votes
1 answer

Passing stdout from interactive python application to cd command (subshell?)

If I am taking over stdout, with an interactive Python script that launches a console GUI such as curses or urwid; after some actions and closing the loop, how could I cd to a path printed in stdout? For example, import sys import urwid def…
0
votes
2 answers

Curses breaks a time.sleep() when terminal's size has been changed

I faced with behavior which I cannot understand. import curses import time myscreen = curses.initscr() y, x = myscreen.getmaxyx() i = 0 while y >= 24 and x >= 80 and i <= 23: myscreen.addstr(i, 0, 'Python curses in action!') …
0
votes
0 answers

inch([y,x]) method not working with color pair Curses Python

I'm working on a terminal window based game using Curses and Python 2.7.12. The game so far is working great, just need to add a basic fight system. However, I got bored with the all white characters on all black. So, I wanted to make the @ sign…
0
votes
0 answers

Storing a function and it's arguments in a dictionary

I don't like how ugly long if/elif statements look. And switch/case statements aren't much better. I find dictionaries easier to read. Now I know how to handle it if each key binding goes to a different function, that's easy. But that would require…
Jonathanb
  • 1,224
  • 1
  • 11
  • 16
0
votes
0 answers

Running subprocess in threads interferes with keyboard input

I've been working on some code that uses subprocess.checkoutput to execute commands on a remote server through ssh: subprocess.check_output(['ssh', '-o', 'StrictHostKeyChecking=no', '-i', 'key.pem', self.pDNS, 'python script.py',…
Frank Wang
  • 181
  • 9
0
votes
1 answer

window.delch() for virtual screen

When I use window.delch(y, x) in curses, python, the delete will happen on the screen, rather than the virtual screen, that is, the character will be deleted even if I don't call window.refresh(). Why is that, and how would I delete the character…
Emlingur
  • 163
  • 8
0
votes
2 answers

Terminal with each line after another + some fixed text as well

I'd like to have both: Lines displayed each one after another (Blah 12, Blah 13, Blah 14, etc.) like in a normal terminal Fixed position information (on right) : Date + fixed text "Bonjour" It nearly works, until ~ Blah 250, when the look is…
Basj
  • 41,386
  • 99
  • 383
  • 673
0
votes
1 answer

How to use UniCurses in Visual Studio 2013

I'm trying to learn Python UniCurses so I can use it in a project I'm working on. Here is what I'm using: Python 2.7 Visual Studio 2013 Python Tools for Visual Studio 2013 I installed the necessary items, UniCurses and PDCurses. And it seems to…
CM-Dev
  • 373
  • 1
  • 5
  • 15
0
votes
1 answer

npyscreen toggle option between TUI and CLI

I am developing a console application to manage firewall devices from a unix server. The console application is based on npyscreen library of python. One of the options I need to provide to the users is login to the device CLI from the TUI thats…
0
votes
1 answer

Python ncurses - how to trigger actions while user is typing?

I am reading user input text with getstr(). Instead of waiting for the user to press enter, I would like to read the input each time it is changed and re-render other parts of the screen based on the input. Is this possible with getstr()? How? If…
jdeo
  • 1
0
votes
1 answer

Bug with refresh in python curses

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…
Alessio Ragno
  • 476
  • 1
  • 6
  • 20
0
votes
0 answers

Is there a way to block terminal size? Or does exist a terminal which allows this?

I'm writing a program in python curses, I just wanted to prevent curses crashing with terminal resizing so I was wondering if there is a way to lock terminal size to 80x24.
Alessio Ragno
  • 476
  • 1
  • 6
  • 20
0
votes
1 answer

addstr delay in Python Curses

I'm working on an AI and I am using Curses and I would like to be able to add a message, wait five seconds then draw another message. Below is the piece I am trying to fix #!/usr/bin/env python # -*- coding: utf-8 -*- import curses import…
Sean Downey
  • 25
  • 1
  • 5