[Urwid] mouse_event to keypress

Angel Kolev meneldor at gmail.com
Fri Feb 15 12:02:00 EST 2013


Thanks Ian, i will test it. But i am not sure what will happen to the
scroll i already made with the Text lines. If i return True from inside any
mouse_event method does unhandled_input in MainLoop catch it?

On Fri, Feb 15, 2013 at 6:56 PM, Ian Ward <ian at excess.org> wrote:

> On Fri, Feb 15, 2013 at 11:52 AM, Angel Kolev <meneldor at gmail.com> wrote:
> > It would be very hard to post the whole code because its separated in
> many
> > files/libs.
> > I created a plugin-based framework and made it to open unlimited
> pop-ups. I
> > made a main class Window which is responsible for all widgets in it.
> Window
> > has a method add_row() so i am building whatever mixed widget i want.
> > Example code for the menu from above:
> >             window = self.new_window(21, 55, text="Choose User and Pass
> for
> > each host (%s)" % len(hosts))
> >             for item in hosts:
> >                 window.add_row([ BaseInput(' User: ',value=item[1][0]),
> > BaseInput(' Pass: ',value=item[1][1]) ],border=item[0])
> >             window.add_buttons([ "Done"])
> >             return window
> > The result from the code above is in the attached screenshot.
> > So, i want to use the mouse scroll to scroll the rows instead of the
> > keyboard, but i cant convert the mouse_event to keypress up/down.
>
> I see.
>
> Maybe you want to convert all unhandled mouse wheel events into
> up/down keystrokes?  That can be done in an unhandled_input callback
> on your MainLoop that checks for the mouse event and calls
> main_loop.process_input(['up']) or ...(['down'])
>
> Ian
>
> _______________________________________________
> Urwid mailing list
> Urwid at lists.excess.org
> http://lists.excess.org/mailman/listinfo/urwid
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.excess.org/pipermail/urwid/attachments/20130215/e48868c1/attachment.htm 


More information about the Urwid mailing list