[Urwid] mouse_event to keypress

Angel Kolev meneldor at gmail.com
Fri Feb 15 11:25:38 EST 2013


Well, the problem is that i cant be sure in what container the BaseInput
will be placed. I tried to call the keypress method of ListBox which is on
top of the BaseInput using:
 some_list_box_object.keypress(size,"down")
but it threw an error about sizing.
It made something similar for Text widgets stored in ListBox:

>         if button == 5:
>             if len(self.body)-1 > self.focus_position:
>                 self.set_focus(self.focus_position+1, coming_from="above")
>         elif button == 4 :
>             if self.focus_position > 0:
>                 self.set_focus(self.focus_position-1, coming_from="below")


So it scrolls trough a list of Text lines perfectly but i cant do it with
Edit's

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

> On Fri, Feb 15, 2013 at 11:08 AM, Angel Kolev <meneldor at gmail.com> wrote:
> > Sorry i meant urwid.Edit. I wrapped it as:
> >>
> >> class BaseInput(urwid.Edit):
> >>       super(BaseInput, self).__init__(.....
> >
> >
> > So i want to initiate a keypress trough a mouse_event. Something like:
> > self.__super.keypress(size,"down")
>
> I see.  Well, it's the ListBox that does the scrolling, so that's the
> thing you should be subclassing.
>
> Your approach should work fine.
>
> 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/1122d4b5/attachment.htm 


More information about the Urwid mailing list