[Urwid] Mouse Handling

Ian Ward ian at excess.org
Wed Mar 15 21:18:05 EST 2006

James Mills wrote:

>inject mouse events into the get_input() buffer.
>Just as you've done with window events such as "window resize".
>You could very well do this with one single "event".
>"mouse event b1 b2 b3 x y"
>where: b1, b2 and b3 are button states and x, y the mouse coordinates.
That's part of it. I'll also need to pass the mouse events to the 
widgets to handle.

I'm thinking of adding an optional mouse_event( x, y, buttons ) method 
to the Widget interface definition.  Composite widgets (like ListBox, 
Columns, Padding etc..) will have to translate the coordinates and call 
the same method in the widgets they contain.

I've noticed alot of duplication in my composite widgets' code. I might 
make a new base class for them that implements the parts of the widget 
interface that just need to pass the call on to one of the contained 
widgets (get_cursor_coords, get_pref_col, move_cursor_to_coords, and now 


More information about the Urwid mailing list