Skip to content

Easy to understand examples of how to use the Urwid module in Python

License

Notifications You must be signed in to change notification settings

sibrcode/urwid-simple-examples

Repository files navigation

urwid-simple-examples

Easy to understand examples of how to use the Urwid module in Python

Although the repository for Urwid at https://github.com/urwid/urwid/tree/master/examples contains over a dozen examples, plus more in the Tutorial section, I found they were often too complex for me to easily understand how different objects fit together. In particular, Urwid is fairly particular about how flow and box objects are combined.

These are simplified illustrations of a few typical Urwid programming patterns.


buttons_in_column.py

Displays three buttons in a Columns object, with handler to highlight the last "clicked" button.

gridflow_in_contents.py

Displays Text objects that have been added to GridFlow object, which will dynamically arrange the position of the text blocks based on available space. Includes a timer to update a time display. Adjust your terminal window size to see the flow behavior.

gridflow_in_frame.py

Similar to the above, but displays a mix of buttons and text.

listbox_in_frame.py

Adds Text objects to a basic ListBox object, which is itself in a Frame. Also shows using the OS's ncurses terminal interface instead Urwid's default of raw_display.

radiobuttons_in_gridflow.py

RadioButton objects are added to a GridFlow object.

text_in_filler.py

This is the simplest example. Just some Text objects inside of a Filler object.

text_in_frame.py

Shows Text objects centered on the screen using a Filled object.

About

Easy to understand examples of how to use the Urwid module in Python

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages