[Urwid] Strange behaviour of ListBox

Julien Muchembled jm at jm10.no-ip.com
Sat Jul 15 18:28:13 EDT 2006


> Here is your problem.  You're passing the size of the screen in to the
> ListBox as though that is its size, so your ListBox thinks it has an
> extra line to display things on. You need to change that last line to:
> 
>                       top.keypress(size, e)

Thanks a lot for the answer.
In fact, I don't pass the key to the top-level widget, because it is a listbox
of 3 elements in Hachoir, not a frame. I found more simple to bypass it.

Here is how I've fixed Hachoir :

--- hachoir/trunk/src/hachoir/ui/urwid/urwid_ui.py	(revision 400)
+++ hachoir/trunk/src/hachoir/ui/urwid/urwid_ui.py	(revision 401)
@@ -304 +304 @@
-            return self.box_widget.keypress(size, key)
+            return BoxAdapter.keypress(self, size, key)
@@ -371 +371 @@
-                    body.keypress(size, e)
+                    body.keypress(size[:1], e)

http://hachoir.python-hosting.com/changeset/401


JM




More information about the Urwid mailing list