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

Is there a focus changed event in urwid?

Is it possible to track the change of the highlighted item in an urwid.ListBox object? Or even via a ListWalker object? I would like to call a callback when the user moves from one item to another using the arrow keys [], [], not when the user hits…
imrek
  • 2,930
  • 3
  • 20
  • 36
3
votes
1 answer

How to get urwid RadioButton and CheckBox values?

In one of the urwid examples, I'm trying to get and print user selected RadioButton and CheckBox values. So far I have code below (python27) and can't figure out which object returns user's selection. import urwid import urwid.raw_display import…
user52028778
  • 27,164
  • 3
  • 36
  • 42
3
votes
1 answer

Urwid, autobahn and twisted eventloop integration

i'm using autobahn to connect to a server and get "push" notifications, and i want to make a simple urwid interface using their twisted event loop. However I am not sure what the best way is to set the urwid text from my autobahn handler class. In…
0x1111
  • 31
  • 2
3
votes
1 answer

urwid listboxes won't scroll

import urwid palette = [('header', 'white', 'black'), ('reveal focus', 'black', 'dark cyan', 'standout'),] content = urwid.SimpleListWalker([ urwid.AttrMap(w, None, 'reveal focus') for w in [ urwid.Text("This is a text string…
ychaouche
  • 4,922
  • 2
  • 44
  • 52
3
votes
2 answers

urwid doesn't update screen on loop.draw_screen()

It is strange but it update screen only 1 of 20 times when I run the program... And if I press any key - it dont update too. No errors if run like python code.py 2>log. And and in mylog.log that I use for internal logging - it says that refresh()…
scythargon
  • 3,363
  • 3
  • 32
  • 62
2
votes
0 answers

Python pygments and urwid.Edit widget(list with tuples)

I have a problem. I try to make an editor for the terminal. So I use urwid, since it supports both key and mouse events. My setup is to use a custom listwalker and one row Edit widget, and the caption set to a line number. The problem is when it…
thabubble
  • 640
  • 1
  • 8
  • 17
2
votes
2 answers

python - urwid simple listbox example

I'm looking at urwid to develop a console app. As a starting point I'm looking for a simple example of a listbox that displays a few rows that can be scrolled using up/down keys. Can anyone provide a simple example of how this can be done or point…
armandino
  • 17,625
  • 17
  • 69
  • 81
2
votes
1 answer

Urwid raising (maxcol,) = size too many values to unpack

I'm trying to create an Urwid UI for a robot. The layout I have in mind is made of three horizontal areas: One liner message (like "unknown key pressed") Running log messages (anything that happens in the robot) Watched variables I'd like to always…
Yaniv Aknin
  • 4,103
  • 3
  • 23
  • 29
2
votes
1 answer

In urwid 'Frame' object has no attribute 'rows'

I am searching any simple way to make urwid.Frame work in python without success, as example, I try this MWE: frame = urwid.Frame(urwid.Text(('some text'), align='center')) filler = urwid.Filler(frame, "top") loop =…
fauve
  • 226
  • 1
  • 10
2
votes
1 answer

urwid auto completion edit widget or pop_up without focus

I am writing an application in python with urwid. I need an Edit widget with autocompletion. Haven't seen one in the documentation so I have tried implementing it on my own based on the pop_up example. However, I am faced with the fact that the…
jakun
  • 624
  • 5
  • 13
2
votes
2 answers

Keypress not working for Edit widget in Urwid

I'm trying to make a terminal application in Python using Urwid. import urwid class Guess(): def __init__(self): self.guess = urwid.Edit(align='center') def keypress(self, size, key): if key.lower() == 'enter': …
magikarp
  • 460
  • 1
  • 8
  • 22
2
votes
1 answer

Is there an equivalent of a GUI text field in urwid?

I'm wondering if the python libary urwid includes an input option that behaves like a GUI text field. By this I mean that, the input option remains editable after the input. individual fields can be filled out in any order. Here is a simple…
2
votes
1 answer

How to update content of SimpleWalkerList in Urwid?

I cant find a proper way to update the content of the SimpleWalkerList in URWID. Below is simplified example of the code I am trying to generate list base on the user input: import urwid palette = [('header', 'white', 'black'), ('reveal…
2
votes
1 answer

How to keep an input bar a the bottom of the screen urwid

I'm working on a chat program in Python and would like to add some user friendly interface to my client. The fact is that I gave myself the challenge of using only terminal. So I found the urwid module to work with, which is cross-platform and…
2
votes
0 answers

define max lines for wrapping textbox

urwid has a number of different widgets that allow text to be displayed, and a few ways to format the text to the window size. How can I format the text of a widget to wrap the first line and truncate the second? To be specific: `a rather long…
anon01
  • 10,618
  • 8
  • 35
  • 58
1 2
3
9 10