Questions tagged [urwid]

Urwid is a console user interface library for Python. It runs on Linux, OSX, Cygwin or other unix-like OS and supports hooking into alternative event loops (AsyncIO, Twisted, GLib).

Urwid is a library for writing console user interfaces. You can see here examples of what's possible.

It offers an alternative to using Python’s curses module directly and handles many of the difficult and tedious tasks.

It comes with several widgets ready to use and it also offers ways create your own widgets, and makes it easy to handle input, terminal resizing and even supports mouse events.

Some applications built with Urwid:

  • pudb - console-based graphicale Python debugger
  • speedometer - tool for measuring the rate of data across a network connection
  • usolitaire - console-based solitaire clone

See more applications built with Urwid in the website list.

Some useful questions

How to create custom widgets

136 questions
29
votes
2 answers

Python ncurses, CDK, urwid difference

What's the difference between these 3? As far as I understand it they both provide binding to curses which is the C library for terminal text-based UI. I currently have no knowledge of any of the 3 and I've never used curses. Which one would you…
s5s
  • 11,159
  • 21
  • 74
  • 121
19
votes
3 answers

Python ABC Multiple Inheritance

I think the code will explain the problem better than I can do with words. Here is the code in my_abc.py: from abc import ABCMeta, abstractmethod class MyABC(object): __metaclass__ = ABCMeta @abstractmethod def print(self): …
moeabdol
  • 4,779
  • 6
  • 44
  • 43
11
votes
2 answers

Python Console UI Suggestions

I'm currently rewriting a perl console application that was using curses, and planning to implement it in Python. So far I've narrowed my library options to straight curses, urwid, and dialog. The application is basically an installer for an…
dkw22
  • 111
  • 3
10
votes
3 answers

Python TUI libs

I'm writing a small sudoku game/solver in Linux using python with TUI (not GUI, that's just lame) just for fun. My question is, which lib is better (by that I mean easier to handle, better support, more straight-forward and understandable), the…
lllluuukke
  • 1,304
  • 2
  • 13
  • 17
8
votes
1 answer

Changing contents of currently displayed listbox in urwid/python2.6

I'm writing a music player in python, with a cli using urwid. I intend to have the current playlist in a simpleListWalker, wrapped by a listbox, then columns, a pile, and finally a frame. How do I replace the entire contents of this listbox (or…
Ripdog
  • 181
  • 2
  • 11
7
votes
3 answers

What are good options for debugging urwid applications?

My current makeshift approach is logging to a textfile, but that isn't very interactive. I've tried using pdb, but that doesn't seem to get along with urwid, pdb doesn't take any input once it hits a breakpoint.
imrek
  • 2,930
  • 3
  • 20
  • 36
7
votes
4 answers

Urwid: make cursor invisible

I'm using urwid, which is a Python "framework" for designing terminal user interfaces in ncurses. There's one thing though that I'm not able to do in urwid that was easy in curses - make the cursor invisible. As it is now, the cursor is visible when…
makos
  • 157
  • 3
  • 14
6
votes
2 answers

How do you make buttons of the python library "urwid" look pretty?

The default appearance of a button in urwid is very functional, but in my eyes not very pretty. It can also be irritating when several buttons are side by side in a row. How can I achieve that a button is displayed with a frame and centered text and…
AFoeee
  • 731
  • 7
  • 24
6
votes
1 answer

correct way to extend __init__ in python 3 from parent class

General Question: What is the easiest/"most pythonic" way to initialize a child class exactly as its parent, but adding a single attribute? My specific question: I'd like to extend an (Urwid) Edit object to include a single additional attribute,…
anon01
  • 10,618
  • 8
  • 35
  • 58
6
votes
1 answer

How do I make a long task non-blocking with urwid and asyncio?

I am writing a Python curses application that controls an external (Linux, if that helps) process by sending and receiving strings through the process' stdin and stdout, respectively. The interface uses urwid. I have written a class to control the…
user4113344
6
votes
2 answers

How can I change an urwid.Edit's text from the 'change' signal handler?

I want to change an urwid.Edit's text from within its "change" signal handler. However, it doesn't do anything. Minimal working example: import urwid input_line = urwid.Edit(multiline=True) def input_change(widget, text): if…
Vegard
  • 2,081
  • 1
  • 17
  • 26
6
votes
1 answer

How to create nested listboxes in urwid?

Is it possible to put ListBoxes inside of SimpleListWalkers ? I'm trying to make nested ListBoxes, but I have this error : AttributeError: 'MyListBox' object has no attribute 'rows' import urwid class MyListBox(urwid.ListBox): def…
ychaouche
  • 4,922
  • 2
  • 44
  • 52
5
votes
2 answers

'NameError: name 'fcntl' is not defined' when using urwid on windows

So I just installed Urwid and as a test tried running the Urwid equivalent of a basic print command, as given as an example on the Urwid website tutorial. I received an error message. I tried running a different one of the examples and received a…
kezper
  • 91
  • 1
  • 3
5
votes
2 answers

How do you combine multiple TUI forms to write more complex applications?

I would like to write a program with a Text-based User Interface (TUI) that consists of several forms. The first form contains a "list". Each list element represents a button. If the respective button is pressed, another form should appear in…
AFoeee
  • 731
  • 7
  • 24
4
votes
2 answers

Urwid ListBox: How to get fluid focus movement?

I have the following code snippet that shows a list of numbers, and highlights the currently in-focus item: import urwid palette = [('header', 'white', 'black'), ('reveal focus', 'black', 'dark cyan', 'standout'),] items = map(lambda x:…
Noah Watkins
  • 5,446
  • 3
  • 34
  • 47
1
2 3
9 10