{"id":6942,"library":"urwid-readline","title":"Urwid Readline","description":"Urwid Readline (urwid-readline) is a Python library that provides a textbox edit widget for the Urwid console UI library, enhancing it with familiar readline-like keyboard shortcuts. Currently at version 0.15.1, the library maintains a stable release cadence as a specialized widget for Urwid applications.","status":"active","version":"0.15.1","language":"en","source_language":"en","source_url":"https://github.com/rr-/urwid_readline","tags":["urwid","terminal-ui","cli","readline","widget"],"install":[{"cmd":"pip install urwid-readline","lang":"bash","label":"Install stable version"}],"dependencies":[{"reason":"Core dependency for the UI toolkit functionality.","package":"urwid"}],"imports":[{"symbol":"ReadlineEdit","correct":"from urwid_readline import ReadlineEdit"}],"quickstart":{"code":"import urwid\nfrom urwid_readline import ReadlineEdit\n\nclass MyReadlineEdit(ReadlineEdit):\n    def keypress(self, size, key):\n        if key == 'enter':\n            # When 'enter' is pressed, update the widget's text\n            self.set_edit_text(f'You typed: {self.edit_text}')\n            return None # Indicate that the key was handled\n        return super().keypress(size, key)\n\n\ndef exit_on_q(key):\n    if key in ('q', 'Q'):\n        raise urwid.ExitMainLoop()\n\n# Create an instance of our custom ReadlineEdit\nedit = MyReadlineEdit(edit_text='Hello, Urwid Readline!', multiline=True)\n\n# Wrap the edit widget in a Filler to allow it to expand\nfill = urwid.Filler(edit, 'top')\n\n# Set up the main loop with our fill widget and a handler for unhandled input\nloop = urwid.MainLoop(fill, unhandled_input=exit_on_q)\n\n# Run the Urwid application\nloop.run()\n","lang":"python","description":"This quickstart creates a simple Urwid application with a `ReadlineEdit` widget. It demonstrates basic input, modifying the widget's text on 'enter', and exiting the application by pressing 'q'. This provides a minimal but functional example of integrating `urwid-readline` into an Urwid application."},"warnings":[{"fix":"Refer to the Urwid library's official documentation and changelog for specific migration steps. Ensure your Urwid dependency is compatible with your urwid-readline version and application code.","message":"urwid-readline is built on top of the Urwid library. Breaking changes in Urwid (e.g., in versions 3.0.0 and 4.0.0) may affect urwid-readline applications. Always check the Urwid changelog when upgrading your Urwid dependency.","severity":"breaking","affected_versions":"Urwid 3.x, 4.x (and potentially earlier versions of Urwid)"},{"fix":"Upgrade your `urwid` dependency to at least version 3.0.5 or newer to ensure compatibility and stability with Python 3.14+ environments.","message":"When using `urwid-readline` with Python 3.14, older versions of the underlying `urwid` library might experience buffer overflow and unpacking errors related to terminal size detection. This was a known issue in `urwid`.","severity":"gotcha","affected_versions":"Urwid < 3.0.5 (specifically with Python 3.14)"},{"fix":"Ensure all UI updates are performed through the `urwid.MainLoop`'s event handling or `set_alarm` mechanism. For dynamic content, use `urwid.Text` or `urwid.Edit` widgets' `set_text` method appropriately. Consult the main Urwid documentation for best practices in updating display elements.","message":"Direct manipulation of Urwid widgets (e.g., for updating text or displaying alarms) can sometimes be non-intuitive and lead to unexpected behavior if not handled within the `urwid.MainLoop` context or by correctly managing widget states. This can be a source of frustration for new users.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-15T00:00:00.000Z","next_check":"2026-07-14T00:00:00.000Z","problems":[]}